Home

Awesome

Menu Library

The Menu library is used to create hierchical html structures ideal for menu structures. It is adapted from the menu class found in FUEL CMS but redistributed here according to the license.

Documentation

This library is capable of outputting standard collapsable menus with helper classes for drop-down or vertical navigation, as well as breadcrumbs and page titles. More complete documentation can be found in the FUEL CMS user guide, but here is a brief overview.

Usage

To create a menu, you must populate an array with the menu items. Then you can output structured HTML suitable for standard navigation by calling the render method. Here's an example:

$this->load->spark('menu-improved/1.0.1');
$nav = array();
$nav['about'] = 'About';
$nav['about/history'] = array('label' => 'History', 'parent_id' => 'about');
$nav['about/contact'] = array('label' => 'Contact', 'parent_id' => 'about');
 
$nav['products'] = 'Products';
$nav['products/X3000'] = array('label' => 'X3000', 'parent_id' => 'products');
 
$active = 'about/history';

$nav['blank-holder'] = array('blank' => TRUE);

$menu = $this->menu->render($nav, $active, NULL, 'basic');
 
echo $menu;
/* echoed output looks something like this
<ul>
	<li class="first active"><a href="/about" title="About">About</a>
		<ul>
			<li class="first"><a href="/about/history" title="History">History</a></li>
			<li class="last active"><a href="/about/contact" title="Contact">Contact</a></li>
		</ul>
	</li>
	<li class="last"><a href="/products" title="Products">Products</a></li>
</ul>
*/

The Menu Array Structure

The menu array can have the following key/value pairs:

Credits