cvs: peardoc /en/package/html html-treemenu.xml
| From: | Christian Weiske | Date: | Sat, 10 May 2008 20:42:10 +0000 |
| Subject: | cvs: peardoc /en/package/html html-treemenu.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-10774@lists.php.net to get a copy of this message | ||
cweiske Sat May 10 20:42:10 2008 UTC
Modified files:
/peardoc/en/package/html html-treemenu.xml
Log:
Move HTML_Treemenu docs from the broken wiki into peardoc (ken, no work for
you!)
http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-treemenu.xml?r1=1.1&r2=1.2&diff_format=u
Index: peardoc/en/package/html/html-treemenu.xml
diff -u peardoc/en/package/html/html-treemenu.xml:1.1 peardoc/en/package/html/html-treemenu.xml:1.2
--- peardoc/en/package/html/html-treemenu.xml:1.1 Sun Aug 29 18:17:53 2004
+++ peardoc/en/package/html/html-treemenu.xml Sat May 10 20:42:10 2008
@@ -1,12 +1,134 @@
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<sect1 id="package.html.html-treemenu">
<title>HTML_TreeMenu</title>
-
+
<para>
- Documentation for this package is available at the <ulink
- url="http://www.wiki.cc/php?title=HTML_TreeMenu">PHP
Wiki</ulink>.
+ This manual page shows the basic steps to get
+ <classname>HTML_TreeMenu</classname> working.
</para>
+ <sect2 id="package.html.html-treemenu.installingfiles">
+ <title>Installing the files</title>
+
+ <para>
+ Before using HTML_TreeMenu, you'll have to put some files in your
+ project's htdocs directory:
+ </para>
+
+ <itemizedlist>
+
<listitem><para><filename>TreeMenu.js</filename></para></listitem>
+
<listitem><para><filename>images</filename></para></listitem>
+ </itemizedlist>
+
+ <para>
+ You can get on your harddrive in
+ <filename>$pear_data_dir/HTML_TreeMenu</filename>
+ or online at the
+ <ulink url="&url.php.cvs.pear;HTML_TreeMenu/">PEAR CVS-Web</ulink>.
+ </para>
+ </sect2>
+
+
+ <sect2 id="package.html.html-treemenu.simpleexample">
+ <title>Simple example</title>
+
+ <programlisting role="php"><![CDATA[
+<?php
+
+require_once 'HTML/TreeMenu.php';
+
+$menu_styles = new HTML_TreeNode(array('text'=>'Styles'));
+$menu_pays = new HTML_TreeNode(array('text'=>'Countries'));
+$menu_restaurants = new HTML_TreeNode(array('text'=>'Restaurants'));
+$menu_plats = new HTML_TreeNode(array('text'=>'Menus'));
+
+for ($i = 1; $i < 10; $i) {
+ $menu_styles->addItem(new HTML_TreeNode(array('icon'=>'Image '.($i
0))));
+ $menu_pays->addItem(new HTML_TreeNode(array('icon'=>'Image '.($i
10))));
+ $menu_restaurants->addItem(new HTML_TreeNode(array('icon'=>'Image
'.($i 20))));
+ $menu_plats->addItem(new HTML_TreeNode(array('icon'=>'Image '.($i
30))));
+}
+
+$menu = new HTML_TreeMenu();
+$menu->addItem($menu_styles);
+$menu->addItem($menu_pays);
+$menu->addItem($menu_restaurants);
+$menu->addItem($menu_plats);
+
+// Chose a generator. You can generate DHTML or a Listbox
+$tree = new HTML_TreeMenu_DHTML($menu);
+
+echo $tree->toHTML();
+
+?>
+]]></programlisting>
+ </sect2>
+
+
+ <sect2>
+ <title>Tree-construction methods</title>
+
+ <para>
+ Actually, you have three different methods to build the tree:
+ </para>
+
+
+ <sect3>
+ <title>By hand</title>
+
+ <para>
+ This is the 'hard' way, like the
+ <link linkend="package.html.html-treemenu.simpleexample">example
above</link>.
+ You have to set each node by hand.
+ </para>
+ </sect3>
+
+ <sect3>
+ <title>Importing XML</title>
+
+ <para>
+ You can import a formatted XML file into the tree structure.
+ It supports string of XML_Tree object :)
+ </para>
+
+ <example>
+ <title>XML Format</title>
+ <programlisting role="xml"><![CDATA[
+<treemenu>
+ <node text="First node" icon="folder.gif"
expandedIcon="folder-expanded.gif" />
+ <node text="Second node" icon="folder.gif"
expandedIcon="folder-expanded.gif">
+ <node text="Sub node" icon="folder.gif"
expandedIcon="folder-expanded.gif" />
+ </node>
+ <node text="Third node" icon="folder.gif"
expandedIcon="folder-expanded.gif">
+</treemenu>
+]]></programlisting>
+ </example>
+
+ <example>
+ <title>Example with a string (not tested)</title>
+ <programlisting role="php"><![CDATA[
+<?php
+require_once 'HTML/TreeMenu.php';
+
+// Load the XML file
+$xml = file_get_contents('tree.xml');
+
+$menu = new HTML_TreeMenu();
+$menu->createFromXML($xml);
+
+// Chose a generator. You can generate DHTML or a Listbox
+//$tree = new HTML_TreeMenu_Listbox($menu);
+$tree = new HTML_TreeMenu_DHTML($menu);
+
+echo $tree->toHTML();
+
+?>
+]]></programlisting>
+ </example>
+ </sect3>
+
+ </sect2>
+
</sect1>
<!-- Keep this comment at the end of the file
Local variables: