RE: [PEAR-DEV] Pear::Tree - Questions and feature requests

From: Date: Sat, 26 Jul 2003 17:31:50 +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-18747@lists.php.net to get a copy of this message
> > Is it possible to remove the [parent] bit and only have [children] > > display its children and their children etc, building a > simple nested > > tree from the top down only, instead of walking up and down through > > the whole tree for each child node? Maybe I'm still missing > > something? > > Actually there are no copies. All the elements in there are only > references, so the array is really only as big as the sum of > all elements! does that answer it all? Not really...getting confused now...LOL. Ok, what I'm trying to do is display the data from tree in a structured fashion. I'm using smarty and have tried doing some of the logic there (would prefer to if possible, at least display logic), but I'm just getting lost trying different arrays, transformations, whatever and I still cant get a basic: <ul> <li> [id] => 2 [parentId] => 1 <ul> <li> [id] => 3 [parentId] => 2 <ul> <li> [id] => 4 [parentId] => 3 <ul> <li> [id] => 9 [parentId] => 4 </li> <li> [id] => 8 [parentId] => 4 </li> </ul> </li> <li> [id] => 6 [parentId] => 3 </li> <li> [id] => 7 [parentId] => 3 </li> </ul> </li> <li> [id] => 5 [parentId] => 2 </li> </ul> </li> </ul> ...type layout...indented child under parent. Its been doing my head in now for over a week. If you've any suggestions (already trying smarty boards too with little success), they'd be much appreciated. <ul> are used here in the example, but may not be the final display method. Thanks for your persistence! -- Simon H

« previous php.pear.dev (#18747) next »