Re: re: TreeMenu and Recursive algorithms

From: Date: Thu, 10 Apr 2003 10:52:33 +0000
Subject: Re: re: TreeMenu and Recursive algorithms
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-4768@lists.php.net to get a copy of this message
Wolfram Kriesing wrote:
i have not tried it, but it should work .... so you wont need recursion, etc.
Hi Wolfram, I've tried getting your code example to work, had some problems. I'm using the latest version of your class and HTML_TreeMenu from PEAR and the test DB from your docs example, tree_nested. I cannot get the node name to show up, in the js that TreeMenu produces I get nulls where the names should be. In other words, the tree is rendered in html, the expanding nodes work, but without node names :-( Here's the slightly modified code I'm using: <?php include 'Tree/Tree.php'; $options = array( 'order' => 'id',
                    'whereAddOn' => '',
                    'table' =>  'tree_nested',
                    'columnNameMaps'=>array(
                        'parentId'      =>  'parent',
                        'name'          =>  'name')
                );
$tree = Tree::setupMemory('DBsimple',// use the simple DB schema
                          'mysql://root@localhost/test',  // the DSN
                          $options);
$tree->setup(); // and now import it into HTML_TreeMenu include 'HTML/TreeMenu.php'; $_treeMenu = HTML_TreeMenu::createFromStructure(
        array(	'structure'=>$tree,
                'type'=>'kriesing'
            )
        );
$treeMenu = new HTML_TreeMenu_DHTML($_treeMenu, array('images' => 'imagesAlt2', 'defaultClass' => 'treeMenuDefault'));
?> <html> <head>
    <style type="text/css">
        .treeMenuDefault {
        font-style: italic;
        }
    </style>
    <script src="TreeMenu.js" language="JavaScript" type="text/javascript"></script>
</head> <body> <?$treeMenu->printMenu()?> </body> </html> cheers, Demian

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