Re: Pear::Tree - Questions and feature requests
| From: | Wolfram Kriesing | Date: | Mon, 21 Jul 2003 18:01:51 +0000 |
| Subject: | Re: Pear::Tree - Questions and feature requests | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-18500@lists.php.net to get a copy of this message | ||
Simon H wrote:
for Memory_DBNested the following also gives youNote quite...getChildren(1,2) gives...1. getNestedTreeArray($root) method - producing a nested array of elements based on parent l and r for positioning. (is this possible already?there is a method getChildren($ids,$levels=1) which takes the level, which is actually the depth to return. that means if you say level=2 then it returns the element given by id and the children of 2 levels deep. is that what you are looking for?
Array(
[0] => Array(
[0] => Array (
[id] => 2
[name] => A1
[comment] =>
[left] => 2
[right] => 8
[parentId] => 1
[children] => which is an array of references
to all the children data
[parent] => which is a reference to the parent
)
[1] => Array (
[id] => 5
[name] => B1
[comment] =>
[left] => 3
[right] => 16
[parentId] => 2
[children] => which is an array of references
to all the children data
[parent] => which is a reference to the parent
)
[2] => Array (
[id] => 3
[name] => A2
[comment] =>
[left] => 18
[right] => 29
[parentId] => 2
[children] => which is an array of references
to all the children data
[parent] => which is a reference to the parent
)
)
)
What I want is a nested tree array, like:
Array(
[0] => Array(
[0] => Array (
[id] => 2 <<-----------------------+
[name] => A1 |
[comment] => |
[left] => 2 |
[right] => 8 |
[parentId] => 1 |
[children] => Array ( |
[0] => Array ( |
[id] => 5 |
[name] => B1 |
[comment] => |
[left] => 3 |
[right] => 16 |
[parentId] => 2 >--+
) ^
[1] => Array ( |
[id] => 3 |
[name] => A2 |
[comment] => |
[left] => 18 |
[right] => 29 |
[parentId] => 2 >--+
)
)
)
)) Hope this clarifies things. Maybe I don't need the data this way? Any suggestions on recursion? for Dynamic_DBNested its not this way i think does that help? -- Wolfram ... opensource @ vision:produktion ... http://opensource.visionp.de ... authentication system .... http://sf.net/projects/auth