PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Menno Merlijn  >  MenuTree  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: MenuTree
Generate hierarchical menu of links
Author: By
Last change:
Date: 9 years ago
Size: 1,395 bytes


Class file image Download
<title>Menu tree example</title>
<link rel="stylesheet" type="text/css" href="treemenu.css" />
<script type="text/javascript" src="treemenu.js" ></script>

<h3>The menu tree</h3>

$t = new TreeMenu();

//adding the tree nodes
$t->node('lastlegion','movies','The Last Legion','',true,"movie.gif");
$t->node('search','start','Searching media');

//deep tree example
$t->node('node1','start','Node depth 1');
$t->node('node2','node1','Node depth 2');
$t->node('node3','node2','Node depth 3');
$t->node('node4','node3','Node depth 4');
$t->node('node5','node4','Node depth 5');
//making the menu tree


//output the menu tree
echo $t->printTree();

<h3>One node of the whole menu tree</h3>

//printing a tree node out of the whole tree
$t->resetTree(); //reset the first tree so we can make a new one