Re: tree structure class

From: Date: Thu, 11 Oct 2001 16:56:46 +0000
Subject: Re: tree structure class
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-2254@lists.php.net to get a copy of this message
* Björn Schotte wrote: > class tree_manager { > > function insert_baum($baum, &$insertarr, $key) { Forgot to mention something about insert_baum(): imagine you have plugins which want to connect into the standard menu tree of the base version of your application. The plugin itself defines it's own menu tree like that: $plugtree = array( "foo" => array( "title" => "Get statistics", "url" => "/bla.php" ), "fasel" => array( "title" => "Print statistics", "url" => "/print_stats.php" ) ); Your base version of your application has the following menu: $menu = array( "admin" => array( "title" => "Administration", "url" => "dfsdfs" ), "statistics" => array( "title" => "Statistics" ) ) ); Then you can easily insert the tree $plugtree into the menu node "Statistics" of the menu tree with insert_baum($menu,$plugtree,"statistics"); Please note: read_categories_into_tree() ist not very performant. I pass over this bottle neck with saving the category tree into session data and only refresh it when needed (i.e. when I insert a new category in the database). I prefer the Menu3 array structure because of the following reasons: - I'm used to it - it is nice to handle - you can use nearly all possible data containers because you convert all to a Menu3 array -- PHP- und MySQL-Schulungen. * Kontakt: * Consultingdienstleistungen. * * Managementseminare als Entscheidungshilfe * team@thinkphp.de * zu einem möglichen Einsatz von PHP und MySQL * 0931 / 78 43 804 *

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