Giter Club home page Giter Club logo

fuel-menu's Introduction

Instalation

1. Copy the files to your fuel/app/ folder.
2. Add the breadrumb to your autoloader on fuel/app/bootstrap.php
	Autoloader::add_classes(array(
		'Menu' => APPPATH.'classes/menu.php',
	));

Routing

The li of the link gets a active class when the link is equal to Uri::string() or when the link have 'part' => true it checks if the link match the beginning of the url (so the parent can get active too), as example below:

Example using Bootstrap

// Top Menu
$top_menu = array(
	'attr'  => array('class' => 'nav'),
	'items' => array(
		array(
			'name' => 'Item 1 <b class="caret"></b>',
			'link' => array(
				'url'  => 'item1',
				'attr' => array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'),
				'part' => true
			),
			'attr' => array('class' => 'dropdown'),
			'menu' => array(
				'attr'  => array('class' => 'dropdown-menu'),
				'items' => array(
					array(
						'name' => 'Sub Item 1',
						'link' => 'item1/sub1'
					),
					array(
						'name' => 'Sub Item 2',
						'link' => 'item1/sub2'
					),
				),
			)
		),
		array(
			'name' => 'Item 2 <b class="caret"></b>',
			'link' => array(
				'url'  => 'item2',
				'attr' => array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'),
				'part' => true
			),
			'attr' => array('class' => 'dropdown'),
			'menu' => array(
				'attr'  => array('class' => 'dropdown-menu'),
				'items' => array(
					array(
						'name' => 'Sub Item 1',
						'link' => 'item2/sub1'
					),
					array(
						'name' => 'Sub Item 2',
						'link' => 'item2/sub2'
					),
				),
			)
		),
		
		// Exemple with routing
		// The route exemple is : 'item(:item)' => array('item/view', 'name' => 'route_item')
		array(
			'name' => 'Item 3 <b class="caret"></b>',
			'link' => array(
				'url'  => array('name' => 'route_item', 'named_params' => array('item' => 3)),
				'attr' => array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'),
				'part' => true
			),
			'attr' => array('class' => 'dropdown'),
			'menu' => array(
				'attr'  => array('class' => 'dropdown-menu'),
				'items' => array(
					array(
						'name' => 'Sub Item 1',
						'link' => 'item3/sub1'
					),
					array(
						'name' => 'Sub Item 2',
						'link' => 'item3/sub2'
					),
				),
			)
		),
	),
);

Menu::forge('top_menu', $top_menu);

View

<?php echo Menu::instance('top_menu')->get(); ?>

License

This is released under the MIT License.

Documentation

Docs coming soon...

Feel free to contribute sending issues and pull request! :D

fuel-menu's People

Contributors

dbpolito avatar jhuriez avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.