Simple menu widget for its corresponding related link pages

This is my first extension, so any feedback and comments will be apperciated.

There are times when one needs to make the main menu item (which does not have any sub-menu) show as active for its corresponding related links; just like for the crud operation where create, update and admin type of links, the menu item will not display in active state.


Tested with Yii 1.1.10 and 1.1.12. may work on other versions


This extension can be used same as CMenu except it take one extra parameter in-order to display the result, which is:

  • $related_links_arr: an array of the related links which you want to associate with the menu item.

For the demonstration purpose, i have used this widget with default menu items.

$this->widget('ext.rlmenu.RLMenu', array(
                    'items' => array(
                        array('label' => 'Home', 'url' => array('/site/index')),
                        array('label' => 'Project', 'url' => array('/project/index'), 'relatedLinks' => array('/project/create', '/project/admin', '/project/view', '/project/update')),
                        array('label' => 'Contact', 'url' => array('/site/contact')),
                        array('label' => 'Login', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest),
                        array('label' => 'Logout (' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest)


Total 3 comments

#13292 report it
Ibrar Turi at 2013/05/21 02:05am
Added demo link

I have added a demo link for this extension, please check it out.

#13291 report it
sefburhan at 2013/05/21 01:53am

thanks soooooooooo much , i was looking for this exactly.

#13289 report it
rajesh chaurasia at 2013/05/21 12:35am
any demo

pls show a demo.....

Leave a comment

Please to leave your comment.

Create extension