Re: threaded comments
| From: | Jochem Maas | Date: | Fri, 08 Apr 2005 08:15:05 +0000 |
| Subject: | Re: threaded comments | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-212626@lists.php.net to get a copy of this message | ||
Sebastian wrote:
i am developing a comment/discussion board and i want to display the results in a threaded style. so far i have it all working except this one issue: each row has an ID and a parentid, say i have 5 rows: id : 10 most oranges come from florida id : 16 ---- Re: most oranges come from florida (parentid 10) id : 22 --------- Re: most oranges come from florida (parentid 16) id : 24 --------- Re: most oranges come from florida (parentid 22)the indentation in your example is off, 24 should be indented one more right?
id : 28 ---- Re: most oranges come from florida (parentid 16) i want the rows to know the id directly above itself so for example, row 5 (id 28) will some how know its parentid (16) is not directly above it and is not accociated with the result its above (24)yes, it will probably involve javascript. also rather than outputting table rows (belonging to a single table) think about outputting as nested DIVs (or ULs.) <div> id : 10 most oranges come from florida
<div>
id : 16 ---- Re: most oranges come from florida (parentid 10)
<div>
id : 22 --------- Re: most oranges come from florida (parentid 16)
<div> id : 24 -------------- Re: most oranges come from florida (parentid 22) </div>id : 28 ---- Re: most oranges come from florida (parentid 16) </div>
</div></div> such a setup would give you a very easy structure to grab/find parents using the DOM/javascript
i want to 'highlight' a row when the parent it belongs to is directly above and do nothing if its not. does this make any sense? very confusing nonetheless. hope someone understands.