PHP Classes

DHTML TreeMenu: Crossbrowser dhtml TreeMenu based on XML data

Recommend this page to a friend!
  Info   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 50%Total: 5,753 All time: 407 This week: 185Up
Version License Categories
dhtmltreemenu 1.0GNU General Publi...HTML


This class generates a DHTML javascript driven TreeMenu from data stored in a small XML file. Supports any level of indentation and works for any browser supporting innerHTML (IE 5.5+ & NS 6+)

Picture of Carlos Falo Hervás
Name: Carlos Falo Hervás <contact>
Classes: 10 packages by
Country: Spain Spain
Age: 48
All time rank: 361 in Spain Spain
Week rank: 658 Down20 in Spain Spain Down
Innovation award
Innovation award
Nominee: 1x


===== BASIC DOCUMENTATION FOR TREEMENU CLASS ===== 0.- INTRODUCTION This class is designed as an easy to manage DHTML TreeMenu object. It is crossbrowser on JavaScript Object Model including innerHTML (IE 5.5+ & NS 6+) and feeds on XML data based in menu.dtd (also included in the package). This class is distributed on GNU GPL based license (see LICENSE) 1.- INTERFACE The public interface for the class is formed by: TreeMenu($file="menu.xml") CONSTRUCTOR: Initialize the object $file -> name for the xml file holding the menu definition NOTES: The object is automatically created as $menu due to needing the object prior to XML parsing. By default it points to menu.xml in the same directori but this file settings can be changed with SetFile method. SetFile($file) SETTING THE SOURCE FILE: Changes the file settings to $file $file -> new source file for the object Generate() JAVASCRIPT INITIALIZATION: Include JS libraries and generate JavaScript src NOTES; This method must be called within the HEAD section of the page and it will automatically inlcude browser.js and TreeMenu.js libraries. It will then generate all Javascript needed to initialize data in the DHTML JavaScript TreeMenu object. PrintMenu() SHOWS THE MENU: It will show the menu in that point 2.- XML MENU FILES A menu file is a small xml file conforming with MENU.DTD. Each file must include at least a MENU element and an OPTION element. MENU ELEMENT: Root element <menu width="<W>" nodewidth="NW" style="S" target="T" indent="I"></menu> W : Total width for the table containing the TreeMenu NW : Width for the node cells (normally that of the node graphics) S : Style to use on the menu texts T : Window/Frame name target to the menu links I : MAX Indentation (number of nested menus) OPTION ELEMENT: Defines menu entries <option length="<L>" url="<U>" value="<V>"></option> L : Number of options in this entry (this node expands to L options) U : Destination Link for the option (can be an expandable node or not) V : Entry text to show in the menu NOTES: Options can be nested, so multiple level menus can be achived (see MENU ELEMENT indent details) 3.- Considerations This class is an hybrid on JavaScript and PHP OOP and can be quite tricky to understand (specially the JavaScript TreeMenu Object), so take it easy :) A base $menu object is created with the inclusion of the class file as it is required by the XML Parser auxiliary functions. The JavaScript object will warn on malformed menu data if more options than those specified with the length argument are set to a given option. This class looks for the js files in DOCUMENT_ROOT/js directory and looks for images in DOCUMENT_ROOT/images/menuicon directory (a set of base node/line graphics ships along the class). 4.- Future releases and WIP Some work will be done so the PHP object can check and validate MENU data (i.e. missing options), but the class is fully usable as is. 5.- Contact information Carlos Falo Hervás C/Manila 54-56 Esc. A Ent. 4ª 08034 Barcelona Spain Phone: +34 9 3 2063652 Fax: +34 9 3 2063689

  Files folder image Files  
File Role Description
Accessible without login Plain text file browser.js Appl. Browser detecttion JS library
Accessible without login Plain text file LICENSE.txt Lic. GNU GPL License
Accessible without login Plain text file menu.dtd Doc. Document Type Definition for the menu files
Accessible without login Plain text file menu.xml Data Sample menu definition
Accessible without login Plain text file readme_en.txt Doc. Documentation (English)
Accessible without login Plain text file test.php Example Test script
Plain text file TreeMenu.class.php Class Base class
Accessible without login Plain text file TreeMenu.js Appl. TreeMenu DHTML object

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:407
This week:185Up
 User Ratings  
 All time