PHP Classes

File: treeviewexample.php

Recommend this page to a friend!
  Classes of Ian Lord   Class Treeview   treeviewexample.php   Download  
File: treeviewexample.php
Role: Example script
Content type: text/plain
Description: Example of usage
Class: Class Treeview
Display a collapsible tree of documents
Author: By
Last change:
Date: 17 years ago
Size: 1,213 bytes
 

Contents

Class file image Download
<?php
   
   
require_once('class/class.treeview.php');

   
$objTreeview = new CLASS_Treeview();
   
$objTreeview->addDocument('File1', 'alert(\'This is document 1\')');
   
$iKey = $objTreeview->addFolder ('Folder1');
   
$iKey2 = $objTreeview->getObjFolder($iKey)->addFolder ('Folder1.1');
   
$iKey3 = $objTreeview->getObjFolder($iKey)->getObjFolder($iKey2)->addFolder ('Folder1.1.1');
   
$objTreeview->getObjFolder($iKey)->getObjFolder($iKey2)->getObjFolder($iKey3)->addDocument('File2', 'alert(\'This is document 2\')');
   
$iKey = $objTreeview->addFolder ('Folder2');
   
$iKey2 = $objTreeview->getObjFolder($iKey)->addFolder ('Folder2.1');
   
$objTreeview->getObjFolder($iKey)->getObjFolder($iKey2)->addFolder ('Folder2.1.1');
   
$iKey = $objTreeview->addFolder ('Folder3');
   
$iKey2 = $objTreeview->getObjFolder($iKey)->addFolder ('Folder3.1');
   
$objTreeview->getObjFolder($iKey)->getObjFolder($iKey2)->addFolder ('Folder3.1.1');
?>
<html>
    <head>
        <title>Treeview example</title>
        <link href="css/treeview.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="js/treeview.js"></script>
    </head>
    <body style="background-color:#dedad9">
        <?php echo $objTreeview->render('100px', '100px'); ?>
</body>
</html>