RE: [PEAR-DEV] Pear::Tree - Questions and feature requests
| From: | Simon H | Date: | Mon, 21 Jul 2003 17:53:46 +0000 |
| Subject: | RE: [PEAR-DEV] Pear::Tree - Questions and feature requests | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-18499@lists.php.net to get a copy of this message | ||
> > 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?
Note quite...getChildren(1,2) gives...
Array(
[0] => Array(
[0] => Array (
[id] => 2
[name] => A1
[comment] =>
[left] => 2
[right] => 8
[parentId] => 1
)
[1] => Array (
[id] => 5
[name] => B1
[comment] =>
[left] => 3
[right] => 16
[parentId] => 2
)
[2] => Array (
[id] => 3
[name] => A2
[comment] =>
[left] => 18
[right] => 29
[parentId] => 2
)
)
)
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?
>
>
> > 2. Pear::MDB support
>
> yep, i will need to look into Lorenzo's patch. Sorry for not being so
> fast. I will try this weekend to do it.
Nice one!
>
> > 3. selectAddon - whereAddon allows SQL after the WHERE,
> select could
> > be in the select?
>
> that is something that Pierre already suggested too. Lets see if he
> will implement it :-)
Go Pierre!!!!!!!! This would be real cool!
>
> --
> Wolfram
--
Simon H