ExplrPHP is a PHP script which provides an easy way to generate tree navigation menu in server-side from various sources of formats: usual PHP array, JSON file, XML file, or MySQL database table.
Requirements:
- PHP5
- jQuery
- Explr jQuery plugin
Code example:
<?php // include the required ExplrPHP class require_once('relative/path/to/Explr.php'); // give each instance a unique tree id $explr = new ExplrPHP('menu2'); // set path to Explr jQuery plugin files $explr->set_src('css', 'http://yourdomain.com/path/to/the/explr/css/file/here/jquery-explr-1.4.css'); $explr->set_src('js', 'http://yourdomain.com/path/to/the/explr/js/file/here/jquery-explr-1.4.min.js'); // only if you hadn't load jQuery before $explr->set_src('jquery', 'http://yourdomain.com/path/to/the/jquery/file/here/jquery-1.5.2.min.js'); // point to the JSON file source we saved earlier $explr->import_json('path/to/our/example.js'); // output tree as HTML and you're done $explr->draw(); ?>