HTML_TreeMenu: createFromXML() problems

From: Date: Fri, 17 Oct 2003 07:14:38 +0000
Subject: HTML_TreeMenu: createFromXML() problems
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8474@lists.php.net to get a copy of this message
Hello, I have been trying to get the createFromXML() function in the HTML_TreeMenu to work without any success. And without any examples to show how this works I come to this newsgroup in search of help! I have to below code: ========================================== require_once('HTML/TreeMenu.php'); require_once('Tree.php'); require_once('XML/Tree.php'); $icon = 'folder.gif'; // instantiate object // uses example xml provided with pakage $xmlTree = new XML_Tree("./treemenu.xml"); $root = $xmlTree->getTreeFromFile(); // create tree from xml object $menu = &HTML_TreeMenu::createFromXML($xmltree); // Create the presentation class $treeMenu = &new HTML_TreeMenu_DHTML(
                            $menu,
                            array('images' => treemenu',
                                  'defaultClass' => 'treeMenuDefault'));
========================================== This produces no errors, However, when i follow this with the "$treeMenu->printMenu()" the tree is not populated with any content. Although the nodes present and are printed correctly... My guess is that there is a either a problem with createFromXML() function. Becuase the example XML seems fine, and i get no erros. From looking at the source it seems to originate from around the area of: ========================================== TreeMenu.php -> createFromXML() (line 246): require_once 'Tree.php'; // Now process the XML_Tree object, setting the XML attributes // to be the tag data (with out the XML tag name or contents). $treeStructure = Tree::createFromXMLTree($xmlTree, true); $treeStructure->nodes->traverse(create_function('&$node', '$tagData = $node->getTag(); $node->setTag($tagData["attributes"]);')); return HTML_TreeMenu::createFromStructure(array('structure' => $treeStructure)); ========================================== But being no expert this makes little sense to me :-( Has anyone got this function to work?? Are the any working examples around?? And, more importantly, is this a problem with the package? Any ideas/input whatsoever would be greatly appreciated! Thanks, Lachy Laycock

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