Re: re: TreeMenu and Recursive algorithms

From: Date: Thu, 10 Apr 2003 11:44:22 +0000
Subject: Re: re: TreeMenu and Recursive algorithms
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-4773@lists.php.net to get a copy of this message
Demian Turner wrote:
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>
                    'columnNameMaps'=>array(
                        'parentId'      =>  'parent',
                        'name'          =>  'name')
Demian, when you remove the name-map it works.
                     'columnNameMaps'=>array(
                         'parentId'      =>  'parent')
please dont ask me right now, why it is this way. i guess it's a bug in the Tree, or something i dont understand right now. I think i have to look into the code but what i find very strange is that in your DB-table are negative numbers, this is really strange :-( but it works when u do the above, i tried it! good luck :-) -- Wolfram ... opensource @ vision:produktion ... http://opensource.visionp.de ... translating template engine .... http://sf.net/projects/simpletpl ... authentication system .... http://sf.net/projects/auth

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