![]() |
|
Keep It Simple, Stupid | |
PerlMonks |
Re: threaded display of repliesby Masem (Monsignor) |
on Apr 28, 2001 at 00:14 UTC ( [id://76255]=note: print w/replies, xml ) | Need Help?? |
Assuming that all the data contains is the node number and the node number of the parent node, you simply cannot find all children; you can only work backwards up from a node to the parent.
However, and where it will get messy, is to take the child node, find it's parent (and all nodes in between), then increament on the node number starting with the ultimate parent node; if the parent of that node is one that is in the thread already, add it to the thread. This will get trees like: Without increamenting on the node number, you cannot get 6, 7 and 8. Nor would you get 2.
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
In Section
Seekers of Perl Wisdom
|
|