Richard Heyes Page 1 21/02/2003
HTML_TreeMenu Documentation
Introduction
HTML_TreeMenu is a set of PHP classes to enable the easy creation of
HTML based tree menus. It currently has the ability to create both DHTML,
static and listbox menus. All have the prerequisite of Javascript, however
the Javscript code could be used manually, without the PHP classes.
Authors
HTML_TreeMenu was written by Richard Heyes and Harald Radi.
Contributions/patches have also been received and incorporated from
various people.
Features
• Easy to learn OO based API
• DHTML (traditional) or listbox (<select>) output styles
• Multiple menus per page
• Cross browser DOM compatible DHTML
• Optional branch status persistence using cookies
• Optional static mode without DHTML (still requires Javascript
support)
• Per node icon with alternate “expanded” icon
• Per node CSS class specification
• Per node link targets
• Per node Javascript event specification with custom onExpand,
onCollapse and onToggle events
• Ability to specify from menu creation if a node is expanded by
default, and if it should be made to be visible (ie its parents are
expanded)
Structure Overview
There are five classes in total:
HTML_TreeMenu The “top level” tree class.
HTML_TreeNode The node class.
HTML_TreeMenu_Presentation An abstract base class for the next
two classes.
HTML_TreeMenu_DHTML Produces a DHTML style menu.
HTML_TreeMenu_Listbox Produces a listbox menu.
The HTML_TreeNode class is used to create the structure which is added to
an instance of the HTML_TreeMenu class. This is in turn passed to an
instance of either of the presentation classes (DHTML or Listbox). These
two “presentation” classes have a printMenu() method which can be called
to print the resulting menu.