Yii extension for multilevel responsive menu

Yii framework extension which provides a multi-level responsive menu using Font Awesome


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


  • Extract the file under protected/extensions folder.


$this->widget('application.extensions.eflatmenu.EFlatMenu', array(
    'items' => array(
        array('label' => 'Home', 'url' => array('/site/index'), 'active' => true, 'icon-class'=>'fa-home'),
        array('label' => 'About', 'url' => array('/site/page', 'view' => 'about')),
        array('label' => 'Contact', 'url' => array('/site/contact')),
        array('label'=>'Level 2 Menu', 'url'=>'#', 'items' => array(
            array('label' => 'Sub-Menu 1', 'url' => '#', 'icon-class'=>'fa-home'),
            array('label' => 'Level 3 Menu', 'url' => '#', 'items' => array(
                array('label' => 'Sub-Menu 1', 'url' => '#', 'icon-class'=>'fa-home'),
                 array('label' => 'Sub-Menu 2', 'url' => '#'),
        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 7 comments

#18025 report it
RakhiKasat at 2014/08/27 09:29am
Need to Add class to last menu item

Hello, I want the last menu item to extreme right hand side. but I cant add class/style/htmloptions.. How can I achieve it? Please help

#17442 report it
Wasim Pathan at 2014/06/12 07:20am
Selected Links are not Showig selected.

Selected Links are not Showing selected. If I click on login link and the page redirects, than Home link is showing as selected .

Any Solution for this.

#16843 report it
Ibrar Turi at 2014/04/03 01:06am

Thanks for mentioning the error :)

The problem was with 'font-awesome.css' file path... which is fixed now.

#16838 report it
VictorG at 2014/04/02 12:59pm
Not registering js and css

I downloaded the extension and was getting an error with font-awesome.css (not found). I took a look in the init function and found the cose skworden sugested, but it turns out that the path to font-awesome.css was '/font-awesome/css/font-awesome.css'. I changed de init function and it worked. I don't know if this is correct (I'm very new to Yii).

Thanks for this excelent extension!

#16286 report it
sefburhan at 2014/02/06 06:02am
@turi thanks for new update

thanks turi for time dedication to extension and support !

#16285 report it
Ibrar Turi at 2014/02/06 05:57am

Updated the code as per @skworden suggestion.

#16271 report it
skworden at 2014/02/04 06:53pm
Not registering js and css

To register the css and js correctly you will need to change public function init() to this and it will work. This is assumed you extracted it to your extensions folder. You can also delete the private items at the top too.

public function init() {
        $scriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('application.extensions.eflatmenu.resources'));
        $cs->registerCssFile($scriptUrl . '/eflatmenu.css');
        $cs->registerCssFile($scriptUrl . '/font-awesome/font-awesome.css');
        $cs->registerScriptFile($scriptUrl . '/eflatmenu.js');

Leave a comment

Please to leave your comment.

Create extension