Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2007-07-11 01:23
Size: 1,395 bytes
 

Contents

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


<h3>The menu tree</h3>
<?php
include_once('TreeMenu.php');

$t = new TreeMenu();

//adding the tree nodes
$t->node('start',false,'Media');
$t->node('movies','start','Movies');
$t->node('next','movies','Next','http://www.nextmovie.com',true,"movie.gif");
$t->node('lastlegion','movies','The Last Legion','http://www.imdb.com/title/tt0462396/',true,"movie.gif");
$t->node('audio','start','Audio',false,false);
$t->node('mtv','audio','MTV','http://mtv.nl/',true,'audio.png');
$t->node('search','start','Searching media');
$t->node('google','search','Google','http://www.google.nl/',true,'search.gif');

//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

$t->makeTree();

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




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


//printing a tree node out of the whole tree
$t->resetTree(); //reset the first tree so we can make a new one
$t->makeTree(true,'movies');
echo 
$t->printTree();

?>


</body>
</html>