Problems using DB_Nestedset and HTML_Menu

From: Date: Tue, 03 Apr 2007 16:16:48 +0000
Subject: Problems using DB_Nestedset and HTML_Menu
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26992@lists.php.net to get a copy of this message
Hello all, I use DB_NestedSet to get a view of the category tree I made. I wanted to use HTML_Menu as an 'Output Driver'. This doesn't seem to work, although I did install HTML_Menu. I get the error: Fatal error: The output driver 'Menu' wasn't found in E:\Alex\Mijn sites\Webserver\php\PEAR\PEAR.php on line 892 HTML_TreeMenu is available but I can't seem to find out how I actually display the tree? It will just return a lot of Javascript to me. I don't know why it all don't work. I just need some advice on how to get it done? I hope I'm not the only one using DB_NestedSet. Here is my directory structure of PEAR (maybe something installed wrong): E:\Alex\Mijn sites\Webserver\php\PEAR\DB\NestedSet.php E:\Alex\Mijn sites\Webserver\php\PEAR\DB\NestedSet\TreeMenu.php E:\Alex\Mijn sites\Webserver\php\PEAR\DB\NestedSet\Output.php E:\Alex\Mijn sites\Webserver\php\PEAR\HTML\Menu.php E:\Alex\Mijn sites\Webserver\php\PEAR\HTML\TreeMenu.php What I think is odd, that NestedSet is inside DB? Because I also tried to use MDB2. But this doesn't work (class is found but I get some error with the methods). I also use smarty by the way so producing output is a problem too. When I tried TreeMenu it simply echoed the output. Which is not good (I need to be able of assigning it). Here is my code: <?php //haal de class op uit de PEAR dir ini_set('include_path', $config['pear_dir']); require('DB/NestedSet.php'); require('DB/NestedSet/Output.php'); require('HTML/Menu.php'); $table_match = array( 'id' => 'id', 'parent_id' => 'rootid', 'lft' => 'l', 'rgt' => 'r', 'order_number' => 'norder', 'level' => 'level', 'name' => 'name' ); $dsn = 'mysql://' . $config['db_user'] . ':' . $config['db_pass'] . '@' . $config['db_host'] . '/' . $config['db_name']; //sla de set alvast op $nested_set = DB_NestedSet::factory('DB', $dsn, $table_match); $nested_set->setAttr(array( 'node_table' => 'exact_categories', 'lock_table' => 'exact_category_locks')); //haal all categorieen op $data = $nested_set->getAllNodes(true); //voeg een url toe foreach($data as $id => $node) { $data[$id]['url'] = "?page6&amp;category=" . $id; } //zorg voor parameters voor de functie HTML_Menu $parameters = array( 'structure' => $data, 'linkField' => 'url', 'textField' => 'name' ); //menu opslaan $menu =& DB_NestedSet_Output::factory($parameters, 'Menu'); //produceer output $menu->printTree(); //geef de pagina weer waar alles te staan komt $smarty->assign('filename', 'tree.tpl'); ?> Ps. I already know about jystewart.net's article. Thanks in advance, Alex

« previous php.pear.general (#26992) next »