previousExemple simple (Previous) (Next) Pagernext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Tree-construction methods

Actuellement, vous avez trois diffréentes méthodes pour construire l'arboresence:

à la main

C'est la voie compliquée, tel que le montre l'exemple ci-dessous. Vous devez indiquer chaque noeud.

En important un XML

Vous pouvez importer un fichier XML formaté dans une structure d'arbre. XML_Tree object est supporté :)

XML Format

<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>

Exemple avec une chaîne (non testé)

<?php
require_once 'HTML/TreeMenu.php';

// On charge le fichier XML
$xml file_get_contents('tree.xml');

$menu = new HTML_TreeMenu();
$menu->createFromXML($xml);

// Choisir un générateur.
// Vous pouvez générer du DHTML ou une liste
//$tree = new HTML_TreeMenu_Listbox($menu);
$tree = new HTML_TreeMenu_DHTML($menu);

echo 
$tree->toHTML();

?>
previousExemple simple (Previous) (Next) Pagernext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.