threaded-comments

How to preserve order of children to appear after their parents

不打扰是莪最后的温柔 提交于 2020-01-07 03:16:08
问题 Expected order by replyid: 55, 57, 58, 59, 60, 56 -- So that the entire 1st parent reply and all its children appear BEFORE the 2nd parent reply The following SQL query returns the wrong order of results WITH RECURSIVE t(replyid, replypid, depth, path, reply, replied, reply_userid) AS ( (SELECT replyid, replypid, 0, array[replyid], reply, replied, replies.userid, u.displayname, u.email_address, (SELECT COUNT(*) FROM reply_revs WHERE replyid = replies.replyid) AS reply_revs FROM replies LEFT

Can Someone hello explain this class for a php threaded comments system?

蓝咒 提交于 2020-01-06 15:32:29
问题 I am trying to implement a threaded comment system using php, and i found something already written, but i can not exactly see how to use it, i am not familiar at all with classes, so i was wondering if someone could help explain how i would use the code. the code below is from the website http://www.jongales.com/blog/2009/01/27/php-class-for-threaded-comments/ the code for the classes is as follows: class Threaded_comments { public $parents = array(); public $children = array(); /** * @param

Trying to get threaded/nested comments in PHP

≯℡__Kan透↙ 提交于 2019-12-25 03:48:35
问题 I have data in a MySQL table, (called info), like this: _______________________ id | text | parent | 1 | a | NULL | 2 | b | 1 | 3 | c | 1 | 4 | d | 2 | ----------------------- (id is auto incrementing) I want to display this data in PHP, like this: >a (ID 1) >>b(ID 2) >>>d (ID 4, parent 2) >>c (ID 3) I have attempted different methods, but I can't seem to be able to get them to work either way. I know I need a recursive function, but how would I do this? A simple pointer would be enough;

SQL Querying for Threaded Messages

依然范特西╮ 提交于 2019-12-23 05:42:50
问题 My site has a messaging feature where one user may message another. The messages support threading - a parent message may have any number of children but only one level deep. The messages table looks like this: Messages - Id (PK, Auto-increment int) - UserId (FK, Users.Id) - FromUserId (FK, Users.Id) - ParentMessageId (FK to Messages.Id) - MessageText (varchar 200) I'd like to show messages on a page with each 'parent' message followed by a collapsed view of the children messages. Can I use

SQL Querying for Threaded Messages

左心房为你撑大大i 提交于 2019-12-23 05:41:09
问题 My site has a messaging feature where one user may message another. The messages support threading - a parent message may have any number of children but only one level deep. The messages table looks like this: Messages - Id (PK, Auto-increment int) - UserId (FK, Users.Id) - FromUserId (FK, Users.Id) - ParentMessageId (FK to Messages.Id) - MessageText (varchar 200) I'd like to show messages on a page with each 'parent' message followed by a collapsed view of the children messages. Can I use

How to build an ASP.NET TreeView From Scratch…?

隐身守侯 提交于 2019-12-13 02:08:02
问题 I am trying to build a nested/threaded comment system in ASP.NET. I don't know how the PHP guys do it. Its much harder than first imagined. I am trying my damnedest get Hierarchical data to output to the user, but its not working. I have a table with text, a itemID and a parentID. I want to display the information in a tree view format, but asp.net's standard control just doesn't work... Can anyone point me in the right direction of how to output this into a treeview. I have tried nesting

How to build Threaded comments with a 1 or 2 queries?

对着背影说爱祢 提交于 2019-12-06 13:23:31
问题 Can anyone suggest a creative database structure + fetching algorithm for a threaded comments system, that would output x amount of threads per page (with unlimited replies for each)? I can run a query to get the threads, and in each instance of a loop, run another query to echo out the replies.... but that's a bad idea. 回答1: If you need only 2 levels, here's a way with one query: Your table - id, parent_id, comment columns Code $rows = mysql_query(' select * FROM comments ORDER BY id DESC');

Need advice on html/css structure for indented, threaded comments

帅比萌擦擦* 提交于 2019-12-06 05:05:43
问题 I want to have a comments section in my app that looks like this: response1 response1a response1b response1b1 response2 response2a response2b response2c response2c1 response2c1a response2c1a1 response2c1a1 response2c1a1a response2c1a1a1 I believe it's called threaded comments. You've probably seen this format on many online discussion sites such as reddit . What I'm wondering is how to implement this in the HTML of my app? What type of html/css combination would make the most sense to allow

How to build Threaded comments with a 1 or 2 queries?

限于喜欢 提交于 2019-12-04 18:43:23
Can anyone suggest a creative database structure + fetching algorithm for a threaded comments system, that would output x amount of threads per page (with unlimited replies for each)? I can run a query to get the threads, and in each instance of a loop, run another query to echo out the replies.... but that's a bad idea. If you need only 2 levels, here's a way with one query: Your table - id, parent_id, comment columns Code $rows = mysql_query(' select * FROM comments ORDER BY id DESC'); $threads = array(); foreach($rows as $row) { if($row['parent_id'] === '0') { $threads[$row['id']] = array(

Need advice on html/css structure for indented, threaded comments

╄→гoц情女王★ 提交于 2019-12-04 10:48:05
I want to have a comments section in my app that looks like this: response1 response1a response1b response1b1 response2 response2a response2b response2c response2c1 response2c1a response2c1a1 response2c1a1 response2c1a1a response2c1a1a1 I believe it's called threaded comments. You've probably seen this format on many online discussion sites such as reddit . What I'm wondering is how to implement this in the HTML of my app? What type of html/css combination would make the most sense to allow this type of application-determined indenting? In your HTML: <div class="comment"> Response1 <div class=