PHP Classes
elePHPant
Icontem

XML to HTML menu: Generate menus in XML and HTML

Recommend this page to a friend!
  Info   View files View files (16)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2006-06-06 (10 years ago) RSS 2.0 feedStarStar 38%Total: 1,891 This week: 1All time: 2,022 This week: 1,047Up
Version License Categories
xmltohtmlmenu 1.0Free for non-comm...HTML, XML, PHP 5
Description Author

This package can be used to generate menus in XML and HTML.

It can add items to the menu definition. Each item can have associated and other attributes.

From the menu definition it can generate a XML document that describes the menus. The menu XML definition documents can also be generated manually or by some other process.

The HTML menus are generated by transforming the menu XML documents into HTML using XSL style sheets.

Picture of Johan Barbier
Name: Johan Barbier <contact>
Classes: 17 packages by
Country: France France
Innovation award
Innovation award
Nominee: 6x

Details
XMLMENU

[PHP5]
DOMDocument and XSLTProcessor enabled are best, but not mandatory.

Called this way :

$menu = xmlmenu::getInstance (optional (string) sVersion, optional (string) sEncoding);

see index.php for more information, and comments in classes.

DESCRIPTION

This package is meant to :
- generate an XML menu
- generate an HTML menu using the generated XML

xmlmenu::getInstance () determines which extensions are or are not enabled, and instanciates the correct class.

First step :
- generate the XML. Can be done with the class, or manually (the xml files are stored in 'xml/'.
They look like :
<menu><node>text1<node>text1_2</node></node><node>text2</node></menu>
3 methods :
xmlmenu::defineNode () to define a new node
xmlmenu::defineAttributes () to define attributes for a given node (can be done directly with xmlmenu::defineNode())
xmlmenu::defineLink () to define the href link of the node

Notice : the node are attributed an id via xml:id.

- see the generated xml via echo $menu (xmlmenu::__toString() method)

- save the xml file if needed via xmlmenu::xmlToFile()

- load an xml from a file via xmlmenu::fileToXml()

- apply an XSL to the menu to generate an HTML menu via xmlmenu::toHTML()
The xsl needs to be created first, of course. I have created 2, they are stored in 'xsl/'.

- save an html menu via xmlmenu::htmlToFile()

  Files folder image Files  
File Role Description
Files folder imageclass (5 files)
Files folder imagehtml (3 files)
Files folder imagetmp_xml (1 file)
Files folder imagexml (3 files)
Files folder imagexsl (2 files)
Accessible without login Plain text file index.php Example index pâge
Plain text file readme.txt Doc. documentation

  Files folder image Files  /  class  
File Role Description
  Accessible without login Plain text file abstractxmlmenu.cls.php Class abstract xml menu class
  Accessible without login Plain text file xmlmenu.cls.php Class xmlmenu factory class
  Accessible without login Plain text file xmlmenuhasboth.cls.php Class xmlmenu class when DOMDocument and XSLTProcessor are enabled
  Accessible without login Plain text file xmlmenuhasdom.cls.php Class xml menu class when only DOMDocument is enabled
  Accessible without login Plain text file xmlmenuhasnone.cls.php Class xml menu class when no extension are enabled

  Files folder image Files  /  html  
File Role Description
  HTML file menu1.html Output html menu example
  HTML file menu2.html Output html menu example
  HTML file menu3.html Output html menu example

  Files folder image Files  /  tmp_xml  
File Role Description
  Plain text file tmp_xmllfile_2.xml Output temp xml file example

  Files folder image Files  /  xml  
File Role Description
  Plain text file menu1.xml Output menu xml example
  Plain text file menu2.xml Output xml menu example
  Plain text file menu3.xml Output xml menu example

  Files folder image Files  /  xsl  
File Role Description
  Plain text file liste.xsl Data list xsl file
  Plain text file table.xsl Data table xsl file

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,891
This week:1
All time:2,022
This week:1,047Up
 User Ratings  
 
 All time
Utility:50%StarStarStar
Consistency:50%StarStarStar
Documentation:37%StarStar
Examples:43%StarStarStar
Tests:-
Videos:-
Overall:38%StarStar
Rank:2742