Search for in the Packages This site (using Yahoo!) Developers Developer mailing list General mailing list SVN commits mailing list
Actually, you have three different methods to build the tree:
This is the 'hard' way, like the example above. You have to set each node by hand.
You can import a formatted XML file into the tree structure. It supports string of XML_Tree object :)
XML Format
<treemenu> <node text="First node" icon="folder.gif" expandedIcon="folder-expanded.gif" /> <node text="Second node" icon="folder.gif" expandedIcon="folder-expanded.gif"> <node text="Sub node" icon="folder.gif" expandedIcon="folder-expanded.gif" /> </node> <node text="Third node" icon="folder.gif" expandedIcon="folder-expanded.gif"> </treemenu>
Example with a string (not tested)
<?phprequire_once 'HTML/TreeMenu.php';// Load the XML file$xml = file_get_contents('tree.xml');$menu = new HTML_TreeMenu();$menu->createFromXML($xml);// Chose a generator. You can generate DHTML or a Listbox//$tree = new HTML_TreeMenu_Listbox($menu);$tree = new HTML_TreeMenu_DHTML($menu);echo $tree->toHTML();?>