Author: dr
Date: Fri Aug 10 14:20:58 2007
New Revision: 5873
Log:
- One more example.
Modified:
trunk/Tree/src/tree.php
Modified: trunk/Tree/src/tree.php
==============================================================================
--- trunk/Tree/src/tree.php [iso-8859-1] (original)
+++ trunk/Tree/src/tree.php [iso-8859-1] Fri Aug 10 14:20:58 2007
@@ -17,6 +17,36 @@
* Which class is used as tree node - this class *must* inherit
* the ezcTreeNode class.
*
+ * Example:
+ * <code>
+ * <?php
+ * // Instantiating an existing tree, and creating a new tree is done
through
+ * // the inherited classes
+ *
+ * // Creating a new in-memory tree
+ * $tree = ezcTreeMemory::create( new ezcTreeMemoryDataStore() );
+ *
+ * // Opening an existing tree in an XML file
+ * $tree = new ezcTreeXml( 'test.xml', new ezcTreeXmlInternalDataStore() );
+ *
+ * // Opening an existing tree from a database, using a nested set backend
+ * // - This retrieves data from the ezcTreeDbExternalTableDataStore store
+ * // using $this->dbh as database handle, $dataTable as table where to
fetch
+ * // data from using 'id' as ID field.
+ * $store = new ezcTreeDbExternalTableDataStore( $this->dbh, $dataTable,
'id' );
+ * // - It uses the 'nested_set' table for keeping the tree structure
+ * $tree = new ezcTreeDbNestedSet( $this->dbh, 'nested_set', $store );
+ *
+ * // Fetching nodes and subtrees
+ * $node = $tree->fetchNodeById( 'He' );
+ * $nodeList = $tree->fetchSubtree( 'Pantherinae' );
+ *
+ * // Checking for relations between nodes
+ * $tree->isDecendantOf( 'Tiger', 'Panthera' );
+ * $tree->isSiblingOf( 'Lion', 'Leopard' );
+ * ?>
+ * </code>
+ *
* @package Tree
* @version //autogentag//
*/
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components