PClib demo site

<?php
/* project: Class tree - basic features, file: basictree.php */

//Include pclib framework
require 'pclib/pclib.php';

//Create pclib application
$app = new PCApp('demo');

$datasource 'mysql://root@localhost/test';
$app->db = new PCDb($datasource);

print 
'<h2>Tree from text file</h2>';
$tree1 = new PCTree;
$tree1->load('data/tree.txt');
print 
$tree1;



print 
'<h2>Tree from database table (TREE_LOOKUPS by default)</h2>';
$tree_id 1;
$tree2 = new PCTree;
$tree2->getTree($tree_id);
$tree2->expandLevel(0);
print 
$tree2;

print 
'<h2>Use your own css-class</h2>';
$tree2->cssClass 'pcmenu';
array_shift($tree2->nodes); //throw away root node
print $tree2;

// You must add tree initialization into your application javascript file:
?>
<script language="Javascript">
window.onload = function() { pclib.initTree(); }
</script>
<?php

Elapsed time: 11.6 ms