yii-menu

Create and edit themeable menus with nested/sortable items
12 followers

Menu Management for Yii Framework

This module allows you to create and edit themeable menus with nested items. This work is inspired from menu management in Wordpress and tries to provide a similar interface to drag and drop items for setting its order and depth.

The module utilizes nestedSortable jQuery plugin for drag-drop sorting of menu items in backend.
Free CSS dropdown menu from http://www.lwis.net/free-css-drop-down-menu/ is used for menu styles and themes.

The code for menu rendering is borrowed from emenu extension.
The code for implementing nestedSortable is borrowed from the dead project at http://code.google.com/p/at-menu

Installation

Download from https://github.com/xtranophilist/yii-menu/zipball/master

Extract the contents of the archive to menu folder inside modules.

Acknowledge Yii about this module by including it into list of modules in config/main.php

        'modules' => array(
                ...
                'menu',
            ),

Add the components and models required to your imports section

        'import' => array(
            ...
            'application.modules.menu.models.*',
            'application.modules.menu.components.*',
            ),

Add Metadata class to components

'components'=>array(
...
        'metadata' => array('class' => 'Metadata'),
...
),

Import menu.sql to install the database schema.

Usage

Browse to /menu to create menu and menu items.
Click on 'Get Code' link to get code for any menu.
Insert the code into any layout or view file.

Git Repo: https://github.com/xtranophilist/yii-menu

Total 3 comments

#16045 report it
xtranophilist at 2014/01/14 10:05am
Maintainence of extensions

Glad you guys like this. Unfortunately, I've switched away from PHP and haven't been able to manage time for maintaining the extensions. If the extensions are really promising, I think the community would appreciate if any of you guys, who are actively developing with Yii, maintain the projects. If you are interested please write me at <my_user_name_here>@gmail.com.

#16044 report it
Trejder at 2014/01/14 08:57am
Five thumbs up!

Great extension! Needs a lot of work to make it usable for a particular application (changing layout etc.), but definitely saves a lot of work and provides very promising, out-of-the box menu solution with both backend editing and frontend displaying.

Keep going, because you're writing an awesome extensions! :>

#14651 report it
tihanyilaci at 2013/09/01 10:39am
Issue about main <ul> element

Hi, that is a great extension. But when i tried to set the main 'ul' html-element's 'id' attribute, I had to rewrite the MenuRenderer class's 'id' attribute to some other name like 'menu_id' because the parent class had yet an 'id' attribute which is to set the 'ul' html-element's 'id' attribute.

class MenuRenderer extends CMenu {
 
    public $menu_id;

So calling the widget is like this:

$this->widget('MenuRenderer', array(
                    'id' => 'topnav',
                    'menu_id' => 4,
                ));

To get this in the html code:

<ul id="topnav">
<li class="first">.....</li>
<li class="last">....</li>
</ul>

Also needed to rewrite the MenuRenderer class's init() function:

.
.
.
} elseif ($this->menu_id) {
            $menu = Menu::model()->findByPk($this->menu_id);
.
.
.

But really good work, helped a lot :)

Laszlo from Hungary

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet