RE: DB_NestedSet getBranch
| From: | Daniel Khan | Date: | Sat, 27 Sep 2003 11:06:47 +0000 |
| Subject: | RE: DB_NestedSet getBranch | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8092@lists.php.net to get a copy of this message | ||
Hi Arnaud,
> I noticed that getBranch returns same-level nodes. Is this intentional ?
> I was expecting getBranch to return ... a branch ;)
>
> I mean, root is 1, 36 and 40 are on the same level, 37 38 and 39 are
> children of each other (39 is child of 38 which is child of 37)
>
> Running a getBranch on node 39 returns 1, 36, 40, 37, 38, 39
>
> 36 and 40 are both on level 2. I was expecting 1, 36, 37, 38, 39 since
> this composes a branch.
Let's take a forum example.
Each new thread is a new rootnode (level 1 node) .
- getBranch(id) just returns all nodes with the same rootnode as the node
given by id.
So this would show the whole thread.
- getSubBranch(id) returns all children of a node given by id.
This will show all replies to a post.
I think that's what you want.
- getChildren(id) returns all immediate (+1level down) children of the node
given by id
Will show all directly referring replies to a posting.
- getParents(id) get's all parents (from level n-1 to level 1) of the node
given by id.
Get the whole thread till the node given by id.
Hope this solves your problem.
greetings
Daniel Khan