CASE 1 : load structure from a JSON string';
echo 'First JSON branch : '.$first->getText().' ('.$first->getId().')';
echo '
';
foreach ($first->items as $next) {
echo '
Next JSON branch : '.$next->getText().' ('.$next->getId().')
';
}
echo '
';
///
// CASE 2 : create a loader TafelTree from an object
//
///
// Create the tree (same options as javascript). In this sample, the file
// drop.php doesn't exist. It's just to show how to manage ajax declarations
$tree =& new TafelTree('divTree', '../imgs/', null, null, array(
'generate' => true,
'onMouseOver'=>'myMouseover',
'onMouseOut'=>'myMouseout',
'defaultImg'=>'page.gif',
'lineStyle'=>'full',
'onDropAjax'=>array('funcDrop', 'drop.php')
));
// Add a root branch
$b1 =& $tree->addBranch('r1', 'root');
// Add two branches into the root
$b1->addBranch('b1', 'branch 1', array('onclick'=>'testclick','thing' => 1));
$b1->addBranch('b2', 'branch 2');
?>
PHP4 sample