Location: PHPKode > scripts > Nested Nodes Class > nested-nodes-class/nodes_test.php
<?php error_reporting(E_ALL); 
 // connect to database
require_once("nodes.class.php");

mysql_connect("localhost","root","slmshdnt");
mysql_select_db("testing");

// please don't change below just read ... 

$nodes = new nodes('categories'); // thats our working table.
$nodes->table_name = 'categories'; // alernative way to se the working table.

$nodes_list = $nodes->build_list(0 , 0);
/*
WAIT .. don't continue reading this file source and get a headache!!
Just modify the database connection values above and watch the file in action in your browser .. i'm sure you will get everything you want to know from these source codes.
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>

<style>
.code_div{
border:dashed #006600 1px;
background:#E8FFEB;
font-family:Georgia, "Times New Roman", Times, serif;
font-size:11px;
word-wrap: break-word;
width:90%;
padding:5px;
}
</style>


<style  type="text/css"> 
/* CSS Menus - Vertical CSS Menu with Popout and Dropdown Menus - 20050131 */


/* End Content Area */
/* ================================================================ 
This copyright notice must be untouched at all times.

The original version of this stylesheet and the associated (x)html
is available at http://www.cssplay.co.uk/menus/final_drop.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This stylesheet and the assocaited (x)html may be modified in any 
way to fit your requirements.
=================================================================== */

.menu {
width:750px; 
font-size:0.85em;
position:relative;
z-index:100;
}
/* remove all the bullets, borders and padding from the default list styling */
.menu ul {
padding:0;
margin:0;
list-style-type:none;
}
.menu ul ul {
width:150px;
}
/* float the list to make it horizontal and a relative positon so that you can control the dropdown menu positon */
.menu li {
float:left;
width:150px;
position:relative;
}
/* style the links for the top level */
.menu a, .menu a:visited {
display:block;
font-size:11px;
text-decoration:none; 
color:#fff; 
width:139px; 
height:30px; 
border:1px solid #fff; 
border-width:1px 1px 0 0; 
background:#758279; 
padding-left:10px; 
line-height:29px;
}
/* a hack so that IE5.5 faulty box model is corrected */
* html .menu a, * html .menu a:visited {
width:150px;
w\idth:139px;
}

/* style the second level background */
.menu ul ul a.drop, .menu ul ul a.drop:visited {
background:#d4d8bd url(../../graphics/drop.gif) bottom right no-repeat;

}
/* style the second level hover */
.menu ul ul a.drop:hover{
background:#c9ba65 url(../../graphics/drop.gif) bottom right no-repeat;
}
.menu ul ul :hover > a.drop {
background:#c9ba65 url(../../graphics/drop.gif) bottom right no-repeat;
}
/* style the third level background */
.menu ul ul ul a, .menu ul ul ul a:visited {
background:#e2dfa8;
}
/* style the third level hover */
.menu ul ul ul a:hover {
background:#b2ab9b;
}


/* hide the sub levels and give them a positon absolute so that they take up no room */
.menu ul ul {
visibility:hidden;
position:absolute;
height:0;
top:31px;
left:0; 
width:150px;
}
/* another hack for IE5.5 */
* html .menu ul ul {
top:30px;
t\op:31px;
}

/* position the third level flyout menu */
.menu ul ul ul{
left:150px; 
top:0;
width:150px;
}
/* position the third level flyout menu for a left flyout */
.menu ul ul ul.left {
left:-150px;
}

/* style the table so that it takes no ppart in the layout - required for IE to work */
.menu table {position:absolute; top:0; left:0;}

/* style the second level links */
.menu ul ul a, .menu ul ul a:visited {
background:#d4d8bd; 
color:#000; 
height:auto; 
line-height:1em; 
padding:5px 10px; 
width:129px
/* yet another hack for IE5.5 */
}
* html .menu ul ul a{
width:150px;
w\idth:129px;
}


/* style the top level hover */
.menu a:hover, .menu ul ul a:hover{
color:#fff; 
background:#949e7c;
}
.menu :hover > a, .menu ul ul :hover > a {
color:#fff;
background:#949e7c;
}

/* make the second level visible when hover on first level list OR link */
.menu ul li:hover ul,
.menu ul a:hover ul{
visibility:visible; 
}
/* keep the third level hidden when you hover on first level list OR link */
.menu ul :hover ul ul{
visibility:hidden;
}

/* make the third level visible when you hover over second level list OR link */
.menu ul :hover ul :hover ul{ 
visibility:visible;
}
</style>
<style type="text/css">
#info {position:relative;}
a.linkup {position:relative;}
a.buttonup {position:absolute; top:130px; left:650px; border:0;}
a.buttonup img {border:0;}

</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>nodes Class Test .. By Shadi Ali</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
</head>
<?
// Simple Usage
if(!isset($_GET["id"])) $_GET["id"] =0;

$ctg_id = $_GET["id"]; ?>
<body style="font-family:Tahoma">
<h3><em>if you are not able to view nodes , firstly modify the database connection values in this file source, seconldy add some nodes using the form below :-)<br>
Don't forget to add as many nodes as you can!! to check this class Magical Powers! </em></h3>
<p>

<p>&nbsp; </p>
<p><hr></p>
<form name="form1" method="post" action="">
 the form below will execute the following.
  <br>
<div class="code_div">
  <code><font color="#000000"><font color="#ff8000">&nbsp;</font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">add_new</font><font color="#007700">(</font><font color="#0000bb">$_POST</font><font color="#007700">[</font><font color="#dd0000">'parent'</font><font color="#007700">] , array(&quot;c_name&quot; =&gt; </font><font color="#0000bb">$_POST</font><font color="#007700">[</font><font color="#dd0000">"name"</font><font color="#007700">] , &quot;c_desc&quot; =&gt; </font><font color="#0000bb">$_POST</font><font color="#007700">[</font><font color="#dd0000">"desc"</font><font color="#007700">] ) ); </font></font></code></div>
<br>
  <table width="400"  border="0" align="center" cellpadding="2" cellspacing="0">
    <tr>
      <td colspan="3" bgcolor="#4180BE"><div align="center"><strong><font color="#FFFFFF">Add New Category </font></strong></div></td>
    </tr>
    <tr>
      <td width="13%">Child Of : </td>
      <td width="1%">:</td>
      <td width="86%"><select name="parent" id="parent">
        <option value="0">ROOT</option>
        <?
		foreach($nodes_list as $c)
		{
			?>
        <option value="<?=$c["id"]?>"  >
        <?=str_repeat("-", $c["prefix"]);?>&raquo;<?=$c["c_name"]?>
        </option>
        <?
		}
		?>
      </select> 
        <font size="1">(ROOT = 0)</font> </td>
    </tr>
    <tr>
      <td>Name:</td>
      <td>:</td>
      <td><input name="name" type="text" id="name" size="20"></td>
    </tr>
    <tr>
      <td>Description:</td>
      <td>:</td>
      <td><textarea name="desc" cols="40" rows="3" id="desc"></textarea></td>
    </tr>
    <tr>
      <td colspan="3"><div align="right">
        <input name="act" type="hidden" value="add">
        <input type="submit" name="Submit" value="Add">
      </div></td>
    </tr>
  </table>

</form>

<p align="center">&nbsp;</p>

</p>
<p>Here is it a Clickable<font size="1">(click to expand) </font>Html Menu<font size="1">(using the default template)</font>:</p>
<br>
<div class="code_div"> <code><font color="#000000"><font color="#0000bb">$ctg_id = $_GET['id']; <font color="#407741">// in this examples , i'm getting the selected node id through a varialbe called 'id' passed via GET. </font><br>
  $nodes </font><font color="#007700">= new </font><font color="#0000bb">nodes</font><font color="#007700">;<br />
  </font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">HtmlTree&nbsp;</font><font color="#007700">=&nbsp;array( <br />
  </font><font color="#dd0000">&quot;OpenTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;ul&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;the&nbsp;overall&nbsp;tag&nbsp;opener&nbsp;,&nbsp;example&nbsp;&lt;ul&gt; <br />
  </font><font color="#dd0000">&quot;FirstLevelOpenTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;[id]&lt;/a&gt;&lt;ul&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;printed&nbsp;for&nbsp;the&nbsp;ROOT&nbsp;parent&nbsp;(&nbsp;node&nbsp;has&nbsp;children/sub-nodes)&nbsp;ie&nbsp;:&nbsp;&lt;ul&gt;&lt;li&gt;&lt;h2&gt;[name]&lt;/h2&gt; <br />
  </font><font color="#dd0000">&quot;FirstLevelOpenTagSelected&quot;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;&lt;b&gt;[id]&lt;/b&gt;&lt;/a&gt;&lt;ul&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;printed&nbsp;for&nbsp;the&nbsp;ROOT&nbsp;parent&nbsp;(&nbsp;node&nbsp;has&nbsp;children/sub-nodes)&nbsp;ie&nbsp;:&nbsp;&lt;ul&gt;&lt;li&gt;&lt;h2&gt;[name]&lt;/h2&gt; <br />
  </font><font color="#dd0000">&quot;LevelOpenTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;[id]&lt;/a&gt;&lt;ul&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;printed&nbsp;for&nbsp;the&nbsp;parent&nbsp;(&nbsp;node&nbsp;has&nbsp;children/sub-nodes)&nbsp;ie&nbsp;:&nbsp;&lt;ul&gt;&lt;li&gt;&lt;h2&gt;[name]&lt;/h2&gt; <br />
  </font><font color="#dd0000">&quot;LevelOpenTagSelected&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;&lt;b&gt;[id]&lt;/b&gt;&lt;/a&gt;&lt;ul&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;//&nbsp;this&nbsp;is&nbsp;printed&nbsp;for&nbsp;the&nbsp;parent&nbsp;(&nbsp;node&nbsp;has&nbsp;children/sub-nodes)&nbsp;..&nbsp;WHEN&nbsp;SELECTED!&nbsp;ie&nbsp;:&nbsp;&lt;ul&gt;&lt;li&gt;&lt;h2&gt;&lt;STRONG&gt;[name]&lt;/STRONG&gt;&lt;/h2&gt;&nbsp; <br />
  </font><font color="#dd0000">&quot;Node&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;[id]&lt;/a&gt;&lt;/li&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;node&nbsp;item&nbsp;tag&nbsp;..&nbsp; <br />
  </font><font color="#dd0000">&quot;NodeSelected&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;&lt;b&gt;[id]&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;node&nbsp;item&nbsp;tag&nbsp;..&nbsp;when&nbsp;selected&nbsp;! <br />
  </font><font color="#dd0000">&quot;FirstLevelCloseTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/ul&gt;&lt;/li&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;ROOT&nbsp;parent&nbsp;tag&nbsp;closer.&nbsp;(&nbsp;when&nbsp;getting&nbsp;out&nbsp;of&nbsp;sub-level) <br />
  </font><font color="#dd0000">&quot;FirstLevelCloseTagSelected&quot;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/ul&gt;&lt;/li&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;ROOT&nbsp;parent&nbsp;tag&nbsp;closer,&nbsp;while&nbsp;selected. <br />
  </font><font color="#dd0000">&quot;LevelCloseTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/ul&gt;&lt;/li&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;parent&nbsp;tag&nbsp;closer.&nbsp;(&nbsp;when&nbsp;getting&nbsp;out&nbsp;of&nbsp;sub-level) <br />
  </font><font color="#dd0000">&quot;LevelCloseTagSelected&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/ul&gt;&lt;/li&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;parent&nbsp;tag&nbsp;closer,&nbsp;while&nbsp;selected. <br />
  </font><font color="#dd0000">&quot;CloseTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/ul&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;the&nbsp;overall&nbsp;tag&nbsp;opener&nbsp;,&nbsp;example&nbsp;&lt;ul&gt; <br />
  </font><font color="#007700">); <br />
  </font>  </font><br>
<font color="#000000"><font color="#ff8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000bb">$output &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#007700">= </font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">html_output</font><font color="#007700">(</font><font color="#0000bb">$ctg_id</font><font color="#007700"> , true); <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#0000bb">$output</font><font color="#007700">;</font></font></code> </div>
<p>
  <?
	// lets display the nodes

		$output 		 = $nodes->html_output($ctg_id , true);
		echo $output;
	?>
</p>

<p>Here is it an expanded Html Menu<font size="1">(using the default template)</font>:</p>
<br>
<div class="code_div"> <code><font color="#000000"><font color="#0000bb">$nodes </font><font color="#007700">= new </font><font color="#0000bb">nodes</font><font color="#007700">;<br />
</font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">HtmlTree&nbsp;</font><font color="#007700">=&nbsp;array( <br />
</font><font color="#dd0000">&quot;OpenTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;ul&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;the&nbsp;overall&nbsp;tag&nbsp;opener&nbsp;,&nbsp;example&nbsp;&lt;ul&gt; <br />
</font><font color="#dd0000">&quot;FirstLevelOpenTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;[id]&lt;/a&gt;&lt;ul&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;printed&nbsp;for&nbsp;the&nbsp;ROOT&nbsp;parent&nbsp;(&nbsp;node&nbsp;has&nbsp;children/sub-nodes)&nbsp;ie&nbsp;:&nbsp;&lt;ul&gt;&lt;li&gt;&lt;h2&gt;[name]&lt;/h2&gt; <br />
</font><font color="#dd0000">&quot;FirstLevelOpenTagSelected&quot;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;&lt;b&gt;[id]&lt;/b&gt;&lt;/a&gt;&lt;ul&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;printed&nbsp;for&nbsp;the&nbsp;ROOT&nbsp;parent&nbsp;(&nbsp;node&nbsp;has&nbsp;children/sub-nodes)&nbsp;ie&nbsp;:&nbsp;&lt;ul&gt;&lt;li&gt;&lt;h2&gt;[name]&lt;/h2&gt; <br />
</font><font color="#dd0000">&quot;LevelOpenTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;[id]&lt;/a&gt;&lt;ul&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;printed&nbsp;for&nbsp;the&nbsp;parent&nbsp;(&nbsp;node&nbsp;has&nbsp;children/sub-nodes)&nbsp;ie&nbsp;:&nbsp;&lt;ul&gt;&lt;li&gt;&lt;h2&gt;[name]&lt;/h2&gt; <br />
</font><font color="#dd0000">&quot;LevelOpenTagSelected&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;&lt;b&gt;[id]&lt;/b&gt;&lt;/a&gt;&lt;ul&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;//&nbsp;this&nbsp;is&nbsp;printed&nbsp;for&nbsp;the&nbsp;parent&nbsp;(&nbsp;node&nbsp;has&nbsp;children/sub-nodes)&nbsp;..&nbsp;WHEN&nbsp;SELECTED!&nbsp;ie&nbsp;:&nbsp;&lt;ul&gt;&lt;li&gt;&lt;h2&gt;&lt;STRONG&gt;[name]&lt;/STRONG&gt;&lt;/h2&gt;&nbsp; <br />
</font><font color="#dd0000">&quot;Node&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;[id]&lt;/a&gt;&lt;/li&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;node&nbsp;item&nbsp;tag&nbsp;..&nbsp; <br />
</font><font color="#dd0000">&quot;NodeSelected&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;&lt;b&gt;[id]&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;node&nbsp;item&nbsp;tag&nbsp;..&nbsp;when&nbsp;selected&nbsp;! <br />
</font><font color="#dd0000">&quot;FirstLevelCloseTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/ul&gt;&lt;/li&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;ROOT&nbsp;parent&nbsp;tag&nbsp;closer.&nbsp;(&nbsp;when&nbsp;getting&nbsp;out&nbsp;of&nbsp;sub-level) <br />
</font><font color="#dd0000">&quot;FirstLevelCloseTagSelected&quot;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/ul&gt;&lt;/li&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;ROOT&nbsp;parent&nbsp;tag&nbsp;closer,&nbsp;while&nbsp;selected. <br />
</font><font color="#dd0000">&quot;LevelCloseTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/ul&gt;&lt;/li&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;parent&nbsp;tag&nbsp;closer.&nbsp;(&nbsp;when&nbsp;getting&nbsp;out&nbsp;of&nbsp;sub-level) <br />
</font><font color="#dd0000">&quot;LevelCloseTagSelected&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/ul&gt;&lt;/li&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;parent&nbsp;tag&nbsp;closer,&nbsp;while&nbsp;selected. <br />
</font><font color="#dd0000">&quot;CloseTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/ul&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;the&nbsp;overall&nbsp;tag&nbsp;opener&nbsp;,&nbsp;example&nbsp;&lt;ul&gt; <br />
</font><font color="#007700">); <br />
</font></font><br>
<font color="#000000"><font color="#ff8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000bb">$output &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#007700">= </font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">html_output</font><font color="#007700">(</font><font color="#0000bb">$ctg_id , false </font><font color="#007700">); <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#0000bb">$output</font><font color="#007700">;</font></font></code> </div>
<p>
  <?
	// lets display the nodes

		$output 		 = $nodes->html_output($ctg_id , false);
		echo $output;
	?>
  <br />
</p>
<hr>
<p>now I'll modify the $HtmlTree value to work with <a href="http://www.cssplay.co.uk/menus/final_drop.html">CSSPlay nested css drop menu</a> </p>
<div class="code_div"><font color="#0000bb" size="1">&lt;?php <br />
  <br />
    $nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">&quot;OpenTag&quot;</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;div&nbsp;class=&quot;menu&quot;&gt;&lt;ul&gt;'&nbsp;</font><font color="#007700" size="1">; <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">'FirstLevelOpenTag'</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;[c_name]&nbsp;([id])&lt;!--[if&nbsp;IE&nbsp;7]&gt;&lt;!--&gt;&lt;/a&gt;&lt;!--&lt;![endif]--&gt;&lt;!--[if&nbsp;lte&nbsp;IE&nbsp;6]&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;![endif]--&gt;&lt;ul&gt;'</font><font color="#007700" size="1">; <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">'FirstLevelOpenTagSelected'</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;&lt;b&gt;[c_name]&nbsp;([id])&lt;/b&gt;&lt;!--[if&nbsp;IE&nbsp;7]&gt;&lt;!--&gt;&lt;/a&gt;&lt;!--&lt;![endif]--&gt;&lt;!--[if&nbsp;lte&nbsp;IE&nbsp;6]&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;![endif]--&gt;&lt;ul&gt;'</font><font color="#007700" size="1">; <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">'LevelOpenTag'</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;[c_name]&nbsp;([id])&lt;!--[if&nbsp;IE&nbsp;7]&gt;&lt;!--&gt;&lt;/a&gt;&lt;!--&lt;![endif]--&gt;&lt;!--[if&nbsp;lte&nbsp;IE&nbsp;6]&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;![endif]--&gt;&lt;ul&gt;'</font><font color="#007700" size="1">; <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">'LevelOpenTagSelected'</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;&lt;b&gt;[c_name]&nbsp;([id])&lt;/b&gt;&lt;!--[if&nbsp;IE&nbsp;7]&gt;&lt;!--&gt;&lt;/a&gt;&lt;!--&lt;![endif]--&gt;&lt;!--[if&nbsp;lte&nbsp;IE&nbsp;6]&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;![endif]--&gt;&lt;ul&gt;'</font><font color="#007700" size="1">; <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">&quot;Node&quot;</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;[c_name]&nbsp;([id])&lt;/a&gt;&lt;/li&gt;'</font><font color="#007700" size="1">;&nbsp;</font><font color="#ff8000" size="1">//&nbsp;item&nbsp;tag&nbsp;..&nbsp; <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">&quot;NodeSelected&quot;</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;li&gt;&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;&lt;strong&gt;[c_name]&nbsp;([id])&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;'</font><font color="#007700" size="1">;&nbsp;</font><font color="#ff8000" size="1">//&nbsp;item&nbsp;tag&nbsp;..&nbsp;when&nbsp;selected&nbsp;! <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">'FirstLevelCloseTag'</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;/ul&gt;&lt;!--[if&nbsp;lte&nbsp;IE&nbsp;6]&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/a&gt;&lt;![endif]--&gt;&lt;/li&gt;'</font><font color="#007700" size="1">; <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">'FirstLevelCloseTagSelected'</font><font color="#007700" size="1">]&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;/ul&gt;&lt;!--[if&nbsp;lte&nbsp;IE&nbsp;6]&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/a&gt;&lt;![endif]--&gt;&lt;/li&gt;'</font><font color="#007700" size="1">; <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">'LevelCloseTag'</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;/ul&gt;&lt;/li&gt;&lt;!--[if&nbsp;lte&nbsp;IE&nbsp;6]&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;![endif]--&gt;'</font><font color="#007700" size="1">; <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">'LevelCloseTagSelected'</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;/ul&gt;&lt;/li&gt;&lt;!--[if&nbsp;lte&nbsp;IE&nbsp;6]&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;![endif]--&gt;'</font><font color="#007700" size="1">; <br />
    </font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">HtmlTree</font><font color="#007700" size="1">[</font><font color="#dd0000" size="1">&quot;CloseTag&quot;</font><font color="#007700" size="1">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;</font><font color="#dd0000" size="1">'&lt;/ul&gt;&lt;/div&gt;'&nbsp;</font><font color="#007700" size="1">; <br />
    <br />
    </font><font color="#0000bb" size="1">$output&nbsp;</font><font color="#007700" size="1">=&nbsp;</font><font color="#0000bb" size="1">$nodes</font><font color="#007700" size="1">-&gt;</font><font color="#0000bb" size="1">html_output</font><font color="#007700" size="1">(</font><font color="#0000bb" size="1">$ctg_id&nbsp;</font><font color="#007700" size="1">,&nbsp;</font><font color="#0000bb" size="1">false&nbsp;</font><font color="#007700" size="1">); <br />
    echo&nbsp;</font><font color="#0000bb" size="1">$output</font><font color="#007700" size="1">; <br />
    </font><font color="#0000bb" size="1">?&gt; <br />
    </font></div>


<br />
<?php

$nodes->HtmlTree["OpenTag"] 				= '<div class="menu"><ul>' ;
$nodes->HtmlTree['FirstLevelOpenTag']			= '<li><a href="?id=[id]">[c_name] ([id])<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--><ul>';
$nodes->HtmlTree['FirstLevelOpenTagSelected']	= '<li><a href="?id=[id]"><b>[c_name] ([id])</b><!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--><ul>';
$nodes->HtmlTree['LevelOpenTag'] 				= '<li><a href="?id=[id]">[c_name] ([id])<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--><ul>';
$nodes->HtmlTree['LevelOpenTagSelected'] 		= '<li><a href="?id=[id]"><b>[c_name] ([id])</b><!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]--><ul>';
$nodes->HtmlTree["Node"]		 					= '<li><a href="?id=[id]">[c_name] ([id])</a></li>'; // item tag .. 
$nodes->HtmlTree["NodeSelected"]	 				= '<li><a href="?id=[id]"><strong>[c_name] ([id])</strong></a></li>'; // item tag .. when selected !
$nodes->HtmlTree['FirstLevelCloseTag']  		= '</ul><!--[if lte IE 6]></td></tr></table></a><![endif]--></li>';
$nodes->HtmlTree['FirstLevelCloseTagSelected']  = '</ul><!--[if lte IE 6]></td></tr></table></a><![endif]--></li>';
$nodes->HtmlTree['LevelCloseTag'] 		 		= '</ul></li><!--[if lte IE 6]></td></tr></table></a><![endif]-->';
$nodes->HtmlTree['LevelCloseTagSelected']		= '</ul></li><!--[if lte IE 6]></td></tr></table></a><![endif]-->';
$nodes->HtmlTree["CloseTag"] 				= '</ul></div>' ;

$output = $nodes->html_output($ctg_id , false );
echo $output;
?>
<br />
<br />
<br />


	<hr style="clear:both;">

<p>What about a <strong>You>Are>Here</strong> like menu ?? <font size="1">(if you can't see the menu, click on a sub-node above and it will work :-) )</font> <br />
<font color="#FF0000" size="1">(using the default template)</font> </p>
<br>
<div class="code_div"> <code><font color="#000000"><font color="#0000bb">$nodes </font><font color="#007700">= new </font><font color="#0000bb">nodes</font><font color="#007700">;<br />
</font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">HtmlRow&nbsp;</font><font color="#007700">=&nbsp;array( <br />
</font><font color="#dd0000">&quot;OpenTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;div&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;the&nbsp;overall&nbsp;tag&nbsp;opener&nbsp;,&nbsp;example&nbsp;&lt;ul&gt; <br />
</font><font color="#dd0000">&quot;Seprator&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&nbsp;&amp;gt;&nbsp;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;seprator&nbsp;between&nbsp;the&nbsp;items.&nbsp;example&nbsp;&quot;&nbsp;&amp;gt;&nbsp;&quot;&nbsp;which&nbsp;means&nbsp;&quot;&nbsp;&gt;&nbsp;&quot; <br />
</font><font color="#dd0000">&quot;NodeUnselected&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;[id]&lt;/a&gt;'</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;item&nbsp;tag&nbsp;..&nbsp; <br />
</font><font color="#dd0000">&quot;NodeSelected&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;a&nbsp;href=&quot;?id=[id]&quot;&gt;&lt;strong&gt;[id]&lt;/strong&gt;&lt;/a&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;item&nbsp;tag&nbsp;..&nbsp;when&nbsp;selected&nbsp;! <br />
</font><font color="#dd0000">&quot;CloseTag&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;</font><font color="#dd0000">'&lt;/div&gt;'&nbsp;</font><font color="#007700">,&nbsp;</font><font color="#ff8000">//&nbsp;this&nbsp;is&nbsp;the&nbsp;overall&nbsp;tag&nbsp;opener&nbsp;,&nbsp;example&nbsp;&lt;ul&gt; <br />
</font><font color="#007700">); </font></font><br>
<font color="#000000"><font color="#ff8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000bb">$output &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#007700">= </font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">html_row_output</font><font color="#007700">(</font><font color="#0000bb">$ctg_id</font><font color="#007700">); // the current node id; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#0000bb">$output</font><font color="#007700">;</font></font></code> </div>
<p>
  <?
	// lets display the nodes

		$output 		 = $nodes->html_row_output($ctg_id);
		echo $output;
	?>
  <br>
  <br>
don't like the look above ..? hmm yeah its ugly!  what about customizing $this-&gt;HtmlRow value a bit ..? <br>
<br>

</p>
<div class="code_div"> <code><font color="#000000"><font color="#0000bb">$nodes </font><font color="#007700">= new </font><font color="#0000bb">nodes</font><font color="#007700">;<br>
</font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">HtmlRow['OpenTag'] </font><font color="#007700">= </font><font color="#dd0000">'</font><font color="#DD0000">&lt;div style=&quot;border:0 ; border-bottom:1px solid #003300; color:#666666; background-color:#F8F8F8; padding:5px&quot;&gt;</font><font color="#dd0000">'</font><font color="#007700">; //<br>
</font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">HtmlRow['Seprator'] </font><font color="#007700">= </font><font color="#dd0000">'&nbsp;&amp;bull;&nbsp;'</font><font color="#007700">; // seprator. <br>
</font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">HtmlRow['NodeSelected'] </font>     <font color="#007700">= </font><font color="#dd0000">'</font><font color="#DD0000">&lt;span style=&quot;font-size:12px; text-decoration:none; color:red; font-family:arial; font-weight:bold&quot; &gt;[[c_name] ([id])]&lt;/span&gt;</font><font color="#dd0000">'</font><font color="#007700">; // hey we have removed the link for the selected node from the template !! wasn't that easy ?! </font><br>
<font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">HtmlRow['NodeUnselected'] </font><font color="#007700">= </font><font color="#dd0000">'</font><font color="#DD0000">&lt;span style=&quot;font-size:12px; text-decoration:none; color:red; font-family:arial; font-weight:bold&quot; &gt;[[c_name] ([id])]&lt;/span&gt;</font><font color="#dd0000">'</font><font color="#007700">; //</font><br>
<font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">HtmlRow['CloseTag'] </font><font color="#007700">= </font><font color="#dd0000">'&lt;/div&gt;'</font><font color="#007700">;<br>
</font></font><font color="#000000"><font color="#ff8000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000bb">$output &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#007700">= </font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">html_row_output</font><font color="#007700">(</font><font color="#0000bb">$ctg_id</font><font color="#007700">); // the current node id; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#0000bb">$output</font><font color="#007700">;</font></font></code> </div>
<p>
<?
	// lets display the nodes
		$nodes->HtmlRow['OpenTag'] = '<div style="border:0 ; border-bottom:1px solid #003300; color:#666666; background-color:#F8F8F8; padding:5px">'; // 
		$nodes->HtmlRow['Seprator'] = '&nbsp;&bull;&nbsp;'; // 
		$nodes->HtmlRow['NodeSelected'] = '<span style="font-size:12px; text-decoration:none; color:red; font-family:arial; font-weight:bold" >[[c_name] ([id])]</span>'; //
		$nodes->HtmlRow['NodeUnselected'] = '<a style="font-size:12px; color:#666666; font-family:arial" href="?id=[id]">[c_name] ([id])</a>'; //
		$nodes->HtmlRow['CloseTag'] = '</div>'; //
		$output 		 = $nodes->html_row_output($ctg_id);
		echo $output;
	?><br>
maybe now it looks better ;-) 
 <font size="1">(if you can't see the menu, click on a sub-node above and it will work :-) )</font>
<hr />	
	<?

	// lets get an array of the nodes for our works
	unset($nodes);
	$nodes = new nodes("categories");
	$nodes_list = $nodes->build_list(0 , 0);

// lets do some actions
if(!isset($_REQUEST['act'])) $_REQUEST['act'] = "";

$act     = $_REQUEST["act"];

switch($act)
{
	case "add":

		// lets add new category
		//  $nodes->add_new( category parent ,  category name , description , icon path , group )

		$nodes->add_new($_POST['parent'] , array("c_name" => $_POST["name"] , "c_desc" => $_POST["desc"] ));
		echo '<script>alert("Category was inserted successfully into database");
		 	 location="nodes_test.php";
	  		</script>';
	break;

	case "delete":
		$nodes->delete($_GET["id"]);
			echo '<script>alert("Node and Sub-nodes were successfully deleted");
		 	 location="nodes_test.php";
	  		</script>';

	break;

	case "order":
		
		$nodes->order_node($_GET["id"] , $_GET['new_order']);
		echo '<script>alert("Node Position was successfully replaced.!");
		 	 location="nodes_test.php";
	  		</script>'; 

	break;
	case "_update":
		$cat = $nodes->fetch($_GET["id"]);

		?>
		<form name="form1" method="post" action="">
          <p> the form below will execute the following. <br>
</p>
          <div class="code_div"> <code><font color="#000000"><font color="#007700">&nbsp;</font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">update</font><font color="#007700">(</font><font color="#0000bb">$_POST</font><font color="#007700">[</font><font color="#dd0000">"id"</font><font color="#007700">] , </font><font color="#0000bb">$_POST</font><font color="#007700">[</font><font color="#dd0000">"parent"</font><font color="#007700">] , </font><font color="#007700">array(&quot;c_name&quot; =&gt; </font><font color="#0000bb">$_POST</font><font color="#007700">[</font><font color="#dd0000">"name"</font><font color="#007700">] , &quot;c_desc&quot; =&gt; </font><font color="#0000bb">$_POST</font><font color="#007700">[</font><font color="#dd0000">"desc"</font><font color="#007700">] )</font><font color="#007700"> );</font></font></code> </div>
          <br>
          <table width="90%"  border="0" align="center" cellpadding="2" cellspacing="0">
    <tr>
      <td colspan="3" bgcolor="#4180BE"><div align="center"><font color="#FFFFFF">Edit Category </font></div></td>
    </tr>
    <tr>
      <td width="13%">Child Of : </td>
      <td width="1%">:</td>
      <td width="86%">
	  <select name="parent" id="parent">
        <option value="0" selected>ROOT</option>
		<?
		foreach($nodes_list as $c)
		{
			if($cat["id"] == $c["id"]) continue; // we don't list the category to be child of itself !!
			?>
			<option value="<?=$c["id"]?>" <? if($c["id"] == $cat["parent"]) echo "selected"; ?> ><?=str_repeat("-", $c["prefix"]);?>&raquo;<?=$c["c_name"]?> >> <?=$nodes->count_nodes($c["id"])?></option>
			<?
		}
		?>
      </select>	  </td>
    </tr>
    <tr>
      <td>Name:</td>
      <td>:</td>
      <td><input name="name" type="text" id="name" value="<?=$cat["c_name"]?>" size="20"></td>
    </tr>
    <tr>
      <td>Description:</td>
      <td>:</td>
      <td><textarea name="desc" cols="40" rows="3" id="desc"><?=$cat["c_desc"]?>
      </textarea></td>
    </tr>
    <tr>
      <td colspan="3"><div align="right">
        <input name="act" type="hidden" value="update">
		<input name="id" type="hidden" value="<?=$ctg_id?>">
		<input type="submit" name="Submit" value="Save">
      </div></td>
    </tr>
  </table>
</form>
		 <?
		 die();

	break;

	case "update":
		$nodes->update($_POST["id"] , $_POST["parent"] , array("c_name" => $_POST["name"] ) );

		echo '<script>alert("Node was updated successfully!");
		 	 location="nodes_test.php";
	  		</script>';
	break;

}



?>

         <p align="center">&nbsp;</p>
         <p align="center"><strong>You may list all your nodes expanded like this</strong></p>
<div class="code_div">
  <code><font color="#000000"><font color="#0000bb">$nodes </font><font color="#007700">= new </font><font color="#0000bb">nodes</font><font color="#007700">; <br>
  &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000bb">$nodes_list </font><font color="#007700">= </font><font color="#0000bb">$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">build_list</font><font color="#007700">(0 , 0);</font></font></code>
  <br>
  // $nodes_list is now an array and you should use foreach command to print something like the following list.
  <br />
  <br />
  <code><font color="#000000">&nbsp;&nbsp;&nbsp; &nbsp;&lt;table&nbsp;width=&quot;90%&quot;&nbsp;&nbsp;border=&quot;0&quot;&nbsp;align=&quot;center&quot;&nbsp;cellpadding=&quot;2&quot;&nbsp;cellspacing=&quot;0&quot;&gt; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&nbsp;bgcolor=&quot;#4180BE&quot;&gt;&lt;font&nbsp;color=&quot;#FFFFFF&quot;&gt;&lt;strong&gt; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nodes&nbsp;List: <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000bb">&lt;?&nbsp;</font><font color="#007700">foreach(</font><font color="#0000bb">$nodes_list&nbsp;</font><font color="#007700">as&nbsp;</font><font color="#0000bb">$c</font><font color="#007700">){ </font><font color="#0000bb">?&gt; <br />
  </font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000bb">&lt;?=str_repeat</font><font color="#007700">(</font><font color="#dd0000">&quot;-&quot;</font><font color="#007700">,&nbsp;</font><font color="#0000bb">$c</font><font color="#007700">[</font><font color="#dd0000">&quot;prefix&quot;</font><font color="#007700">]);</font><font color="#0000bb">?&gt;</font>&amp;raquo;<font color="#0000bb">&lt;?=$c</font><font color="#007700">[</font><font color="#dd0000">&quot;c_name&quot;</font><font color="#007700">]</font><font color="#0000bb">?&gt;</font>&nbsp;&gt;&gt;&nbsp;<font color="#0000bb">&lt;?=$nodes</font><font color="#007700">-&gt;</font><font color="#0000bb">count_nodes</font><font color="#007700">(</font><font color="#0000bb">$c</font><font color="#007700">[</font><font color="#dd0000">&quot;id&quot;</font><font color="#007700">])</font><font color="#0000bb">?&gt;</font>&nbsp;-&nbsp;&lt;font&nbsp;size=&quot;1&quot;&gt;[&lt;a&nbsp;href=&quot;?act=_update&amp;id=<font color="#0000bb">&lt;?=$c</font><font color="#007700">[</font><font color="#dd0000">&quot;id&quot;</font><font color="#007700">]</font><font color="#0000bb">?&gt;</font>&quot;&gt;Edit&lt;/a&gt;&nbsp;-&nbsp;&lt;a&nbsp;href=&quot;?act=delete&amp;id=<font color="#0000bb">&lt;?=$c</font><font color="#007700">[</font><font color="#dd0000">&quot;id&quot;</font><font color="#007700">]</font><font color="#0000bb">?&gt;</font>&quot;&gt;Delete&lt;/a&gt;&nbsp;-&nbsp;&lt;a&nbsp;href=&quot;?act=order&amp;id=<font color="#0000bb">&lt;?=$c</font><font color="#007700">[</font><font color="#dd0000">&quot;id&quot;</font><font color="#007700">]</font><font color="#0000bb">?&gt;</font>&amp;new_order=<font color="#0000bb">&lt;?=$c</font><font color="#007700">[</font><font color="#dd0000">'ord'</font><font color="#007700">]-</font><font color="#0000bb">1?&gt;</font>&quot;&gt;Move&nbsp;Up&lt;/a&gt;&nbsp;-&nbsp;&nbsp;&lt;a&nbsp;href=&quot;?act=order&amp;id=<font color="#0000bb">&lt;?=$c</font><font color="#007700">[</font><font color="#dd0000">&quot;id&quot;</font><font color="#007700">]</font><font color="#0000bb">?&gt;</font>&amp;new_order=<font color="#0000bb">&lt;?=$c</font><font color="#007700">[</font><font color="#dd0000">'ord'</font><font color="#007700">]+</font><font color="#0000bb">1?&gt;</font>&quot;&gt;Move&nbsp;Down&lt;/a&gt;&nbsp;] <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/font&gt;&lt;/td&gt; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000bb">&lt;? } </font><font color="#0000bb">?&gt; <br />
</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/table&gt; </font></code></div>
        <br>
         <table width="90%"  border="0" align="center" cellpadding="2" cellspacing="0">
		<tr>
			<td bgcolor="#4180BE"><font color="#FFFFFF"><strong>
			nodes List:
			</strong></font></td>
		</tr>
		<?
			foreach($nodes_list as $c)
			{
				?>

				<tr>
					<td>

					<?=str_repeat("-", $c["prefix"]);?>&raquo;<?=$c["c_name"]?> >> <?=$nodes->count_nodes($c["id"])?> - <font size="1">[<a href="?act=_update&id=<?=$c["id"]?>">Edit</a> - <a href="?act=delete&id=<?=$c["id"]?>">Delete</a> - <a href="?act=order&id=<?=$c["id"]?>&new_order=<?=$c['ord']-1?>">Move Up</a> -  <a href="?act=order&id=<?=$c["id"]?>&new_order=<?=$c['ord']+1?>">Move Down</a> ]
					</font></td>
				</tr>

				<?
			}
		?>
		</table>



<p align="center">&nbsp;</p>
<p align="center"><strong>Or you may also use it in a combo box</strong><br />
</p>
<div class="code_div"><code><font color="#000000">&lt;select&nbsp;&gt;<br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000bb">&lt;?&nbsp;</font><font color="#007700">foreach(</font><font color="#0000bb">$nodes_list&nbsp;</font><font color="#007700">as&nbsp;</font><font color="#0000bb">$c</font><font color="#007700">){&nbsp;</font><font color="#0000bb">?&gt; <br />
      </font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;option&nbsp;value=&quot;<font color="#0000bb">&lt;?=$c</font><font color="#007700">[</font><font color="#dd0000">&quot;id&quot;</font><font color="#007700">]</font><font color="#0000bb">?&gt;</font>&quot;&gt;<font color="#0000BB">&lt;?=</font><font color="#0000FF">str_repeat</font>(&quot;-&quot;, $c[&quot;prefix&quot;]);<font color="#0000CC">?&gt;</font>&amp;raquo;<font color="#0000bb">&lt;?=$c</font><font color="#007700">[</font><font color="#dd0000">&quot;c_name&quot;</font><font color="#007700">]</font><font color="#0000bb">?&gt;</font>&nbsp;&lt;/option&gt; <br />
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000bb">&lt;? </font>      <font color="#007700">} </font><font color="#0000bb">?&gt;<br />
      </font>&nbsp;&lt;/select&gt;</font></code></div>
<table width="0" border="0" align="center" cellpadding="2" cellspacing="0">
  <tr>
    <td width="72"><select name="category_id" id="category_id">

      <?
		foreach($nodes_list as $c)
		{
			?>
			 <option value="<?=$c["id"]?>"><?=str_repeat("-", $c["prefix"]);?>&raquo;<?=$c["c_name"]?> </option>
      <?
		}
		?>
            </select></td>
    <td width="0"><input type="button" name="Button" value="Edit" onClick="location='nodes_test.php?act=_update&id='+document.getElementById('category_id').value;"></td>
    <td width="0"><input type="button" name="Button" value="Delete" onClick="location='nodes_test.php?act=delete&id='+document.getElementById('category_id').value;"></td>
  </tr>
</table>

</body>
</html>
Return current item: Nested Nodes Class