HTML_TreeMenu
[ class tree: HTML_TreeMenu ] [ index: HTML_TreeMenu ] [ all elements ]

Class: HTML_TreeMenu

Source Location: /HTML_TreeMenu-1.2.2/HTML/TreeMenu.php

Class Overview


HTML_TreeMenu Class


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 72]
HTML_TreeMenu Class

A simple couple of PHP classes and some not so simple Jabbascript which produces a tree menu. In IE this menu is dynamic, with branches being collapsable. In IE5+ the status of the collapsed/open branches persists across page refreshes.In any other browser the tree is static. Code is based on work of Harald Radi.

Usage.

After installing the package, copy the example php script to your servers document root. Also place the TreeMenu.js and the images folder in the same place. Running the script should then produce the tree.

Thanks go to Chip Chapin (http://www.chipchapin.com) for many excellent ideas and improvements.



[ Top ]


Class Variables

$items =

[line 79]

Indexed array of subnodes
  • Access: public

Type:   array


[ Top ]



Method Detail

HTML_TreeMenu (Constructor)   [line 86]

HTML_TreeMenu HTML_TreeMenu( )

Constructor
  • Access: public

[ Top ]

addItem   [line 100]

int &addItem( HTML_TreeNode &$node)

This function adds an item to the the tree.
  • Return: Returns a reference to the new node inside the tree.
  • Access: public

Parameters:

HTML_TreeNode   &$node   —  The node to add. This object should be a HTML_TreeNode object.

[ Top ]

createFromStructure   [line 130]

HTML_TreeMenu createFromStructure( array $params)

Import method for creating HTML_TreeMenu objects/structures out of existing tree objects/structures.

Currently supported are Wolfram Kriesings' PEAR Tree class, and Richard Heyes' Tree class (http://www.phpguru.org/). This method is intended to be used statically, eg:

  1.  $treeMenu &HTML_TreeMenu::createFromStructure($myTreeStructureObj);


Parameters:

array   $params   —  An array of parameters that determine how the import happens. This can consist of:
                          structure   => The tree structure
                          type        => The type of the structure, currently
                                         can be either 'heyes' or 'kriesing'
                          nodeOptions => Default options for each node

[ Top ]

createFromXML   [line 306]

HTML_TreeMenu createFromXML( string|XML_Tree $xml)

Creates a treeMenu from XML.

The structure of your XML should be like so:

  1.  <treemenu>
  2.      <node text="First node" icon="folder.gif"
  3.            expandedIcon="folder-expanded.gif" />
  4.      <node text="Second node" icon="folder.gif"
  5.            expandedIcon="folder-expanded.gif">
  6.          <node text="Sub node" icon="folder.gif"
  7.                expandedIcon="folder-expanded.gif" />
  8.      </node>
  9.      <node text="Third node" icon="folder.gif"
  10.            expandedIcon="folder-expanded.gif">
  11.  </treemenu>

Any of the options you can supply to the HTML_TreeNode constructor can be supplied as attributes to the <node> tag. If there are no subnodes for a particular node, you can use the XML shortcut <node ... /> instead of <node ... ></node>. The $xml argument can be either the XML as a string, or an pre-created XML_Tree object. Also, this method REQUIRES my own Tree class to work (http://www.phpguru.org/static/tree.html). If this has not been include()ed or require()ed this method will die().


Parameters:

string|XML_Tree   $xml   —  This can be either a string containing the XML, or an XML_Tree object

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:40:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.