Following on from Angelos's message. . .
I have writen a class that does what I wanted except the UL LI part...
anyway .I am going to paste you the code here.
The logic of this script is part of phpLayersMenu in sourceforge but much
simpler.
If at anytime you redevelop that code, I would like to send me the changes
...
As far as I know it can display unlimited levels of menus.
It is one thing to be able to generate a 'tree' menu with nodes, sub
nodes etc but another to be able to open and shut dynamically using
javascript. What I have done is to write a class (actually 2 classes )
that interfaces with Tigra Tree ['free']
(
www.softcomplex.com/products/tigra_menu_tree/). I've added the ability
to use templates at different levels. The test program below should
give you a flavour. Ask if you want the code (11k too big for news)
<?php
/*
menu tree
---------
This example populates a 2-level tree showing employees
by department. It illustrates templates for links.
Note the order in which items are added to the tree.
Always add item to tree/parent node BEFORE adding children to it
Nodes are added as references so unset() before re-using a node
Files required
../cl/menutree.phpc
../tools/mnu/tree.js
../tools/mnu/tree_tpl.js
graphic files as specified in tree_tpl.js
*/
require_once('. ./cl/menutree.phpc') ;
// dummy data
$departments=ar ray();
$e1=array(1=>'P eter fox',2=>'Sally Fox',3=>'Geoffr ey Fox');
$e2=array(11=>' Teddy fox',12=>'Jean Fox');
$departments[1]=array('Sales', $e1);
$departments[10]=array('Product ion',$e2);
// set up tree and organise templates
$t = new menuTree();
$t->AddLinkTemplat e(1,'');
$t->AddLinkTemplat e(2,'department .php?DEPT=[DID]');
$t->AddLinkTemplat e(3,'employee.p hp?EMPNO=[EID]');
// highest level is always shown and doesn't collapse
$tnode = new treeNode('Emplo yees by department');
$t->AddNode($tnode );
// populate tree
foreach($depart ments as $did=>$dept){
$departmentName =$dept[0];
$dnode = new treeNode($depar tmentName,array ('DID'=>$did));
$tnode->AddChild($dnod e);
$employeesOfDep t=$dept[1];
foreach($employ eesOfDept as $eid=>$employee Name){
$dnode->AddChild(new treeNode($emplo yeeName,array(' EID'=>$eid)));
}
unset($dnode);
}
// illustrate bypassing template using blank for data key
$snode = new treeNode('somet hing special',array( ''=>'myhomepage .php'));
$tnode->AddChild($snod e);
// show it
print($t->CompleteMenu() );
?>
--
PETER FOX Not the same since the poster business went to the wall
pe******@eminen t.demon.co.uk.n ot.this.bit.no. html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.dem on.co.uk>