Each entry has 'url' and 'title' elements and may also have 'sub' element containing the children of this entry. Note that keys in the entry arrays serve as node identificators and should be unique.
The menu entries can also contain custom keys. If such keys are present, then they will be used by renderers in creating the output (this usually means that the content of such a key will be assigned to the template placeholder with the same name).
Supported output modes
HTML_Menu supports five output modes: 'tree' (default), 'rows', 'urhere', 'prevnext' and 'sitemap'. Lets use the array defined above as menu structure assuming that element 'Menu item 1.2' is currently active and try each menu type.
Possible menu types
'tree'
This type of the menu mostly follows the internal structure of the menu hash. Different levels of the menu are marked by indentation, only the elements leading to the active item or immediately following it are shown.
// Load the class require_once 'HTML/Menu.php'; // Instantiate the menu object, we presume that $data contains menu structure $menu =& new HTML_Menu($data, 'tree'); // Output the menu $menu->show();
Deliver First Class Web Sites: 101 Essential Checklists Want to learn how to make your web sites usable and accessible? Want to ensure that your sites meet current best practice, without spending hours trawling through incomprehensible specifications and recommendations from dozens of different books, research papers, and web sites? Want to make sure that the sites you build are "right the first time," requiring no costly redevelopments?