bigfishtv / magicmenu
A CakePHP Plugin to generate HTML menus
Installs: 43
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- cakephp/cakephp: >3.4.1
Requires (Dev)
README
Installation
composer require bigfishtv/magicmenu
Usage
AppView.php
$this->loadHelper('MagicMenu.MagicMenu');
[your-view].[ctp|php]
$items = [ ['title' => 'About', 'url' => '/about'], ['title' => 'Work', 'url' => '/work', 'children' => [ ['title' => 'One', 'url' => '/work/one'], ['title' => 'Two', 'url' => '/work/two'], ['title' => 'Three & Four', 'url' => '/work/three-and-four'], ]], ['title' => 'Contact', 'url' => '/contact'] ]; $menu = $this->MagicMenu->create($items); echo $menu->render();
Output
<ul> <li> <a href="/about"> <span>About</span> </a> </li> <li> <a href="/work"> <span>Work</span> </a> <ul> <li> <a href="/work/one"> <span>One</span> </a> </li> <li> <a href="/work/two"> <span>Two</span> </a> </li> <li> <a href="/work/three-and-four"> <span>Three & Four</span> </a> </li> </ul> </li> <li> <a href="/contact"> <span>Contact</span> </a> </li> </ul>