Yii 1.1: jqueryslidetopmenu

This extension is a very simple to use multi-level top menu based on jqueryslidemenu




  • Yii 1.0 or above


  • Extract the release file under protected/components


See the following code example:

$this->widget('application.components.JQuerySlideTopMenu.JQuerySlideTopMenu', array(
        array('label'=>'Home', 'url'=>array('site/index')),
        array('label'=>'WIKI', 'url'=>'#', 'subs'=>array(
                array('label'=>'New article', 'url'=>'#'),
            ), 'visible'=>!Yii::app()->user->isGuest),
        array('label'=>'Blog', 'url'=>'#', 'subs'=>array(
                array('label'=>'New post', 'url'=>'#'),
            ), 'visible'=>!Yii::app()->user->isGuest),
        array('label'=>'Admin tools', 'url'=>'#', 'subs' => array(
                array('label'=>'Users', 'url'=>'#', 'subs' => array(
                        array('label'=>'Add new user', 'url'=>array('auth.users/create')),
                        array('label'=>'List', 'url'=>array('auth.users/list')),
                array('label'=>'Customers', 'url'=>'#', 'subs' => array(
                        array('label'=>'Add new', 'url'=>'#'),
                        array('label'=>'List', 'url'=>'#'),
                array('label'=>'Projects', 'url'=>'#', 'subs' => array(
                        array('label'=>'Add new', 'url'=>'#'),
                        array('label'=>'List', 'url'=>'#'),
                array('label'=>'Accounting setup', 'url'=>'#', 'subs' => array(
                        array('label'=>'Employees', 'url'=>'#'),
                        array('label'=>'Bank accounts', 'url'=>'#'),
                        array('label'=>'Settings', 'url'=>'#'),
                array('label'=>'Roles & Permissions', 'url'=>'#'),
                array('label'=>'Settings', 'url'=>'#'),
            ), 'visible'=>!Yii::app()->user->isGuest),
        array('label'=>'My profile', 'url'=>'#', 'visible'=>!Yii::app()->user->isGuest),
        array('label'=>'Login', 'url'=>array('site/login'), 'visible'=>Yii::app()->user->isGuest),
        array('label'=>'Logout', 'url'=>array('site/logout'), 'visible'=>!Yii::app()->user->isGuest)

Change Log

February 24, 2009

  • Initial release.

Total 10 comments

#7650 report it
Finzaiko at 2012/04/04 11:54pm
Submenu not show up on mouseover

follow comments mitoasoy and use the instructions, I had the same problem, I already logged in when i mouseover on "admin tools", sub menu (including image down.gif) still does not work submenu doese not showing, anyone give me solution, Thanks

#3914 report it
Rodrigo at 2011/05/20 02:08pm
URL with view option

In reply to Luiz:

to get url with options working, would be enough to replace



#3913 report it
Rodrigo at 2011/05/20 01:00pm
Login to see submenus

In reply to mitoasoy

But when i run my Yii Application in browser, why did the menu become only Home and Login?it seems like the other menu which has submenu didn't work and did'nt even showed up. Somebody help me pleaseeeee....

These menus aren't visible to guest users, so You must login to see them or just comment out the lines

#3135 report it
at 2011/03/20 05:35am
Great Menu

It's Great menu I Like It

#2315 report it
Luiz at 2010/12/11 06:59pm
URL with view option

the following command (link with 'view' option) not working properly:

array('label'=>'Sobre', 'url'=>array('/site/page', 'view'=>'about')),

So I had to make some changes in code:

         $item2['url']= CHtml::normalizeUrl($item['url']);
    else            $item2['url']=CHtml::tag('span',isset($item['linkOptions']) ? $item['linkOptions'] : array(), $item['label']);

this is correct?

#10 report it
Tommy at 2010/10/13 05:26am
This didn't work on mine

Hi Guys,

I put main.css inside CSS folder (replacing current main.css) and i put JQuerySlideTopMenu folder inside protected/components (so it become protected/components/JQuerySlideTopMenu/JQuerySlideTopMenu.php Then i copy php code in this JquerySlideTopMenu documentation (http://www.yiiframework.com/extension/jqueryslidetopmenu/#doc) replacing my current menu in protected/views/layouts/main.php

But when i run my Yii Application in browser, why did the menu become only Home and Login?it seems like the other menu which has submenu didn't work and did'nt even showed up.

Somebody help me pleaseeeee....

#1618 report it
shocky at 2009/06/02 09:02am
remove display: inline from main.css


I also have the same problem, and I have found main.css conflicts with jqueryslidemenu.css in #mainmenu like following:

@@ -59,11 +59,10 @@ body
    background: #90B3DC;
 #mainmenu ul li
-   display: inline;
    background: #90B3DC;
 #mainmenu ul li a

In my case, just removing above line is enough. You can explore css files using firebug or other extension with ease.

#1825 report it
oleksiy at 2009/03/24 03:39am
The menu is not working after fix

Guys, this menu is using unchanged dynamicdrive code so this is definitely not the extension bug. I think you are trying it with default Yii testdrive application? So there seems to be a conflict with default Yii css styles... I will upload main.css file that works for me.

#1826 report it
arsitek at 2009/03/23 06:42pm
Undefined index: subs

Yeah.. I have the same problem like henqi..

Waiting for update..

#1842 report it
henqi at 2009/03/10 07:07am
The menu is not working after fix

I need to add this code

 isset($item['subs']) &&

in 2 files in both JQuerySlideTopMenu.php and view.php to avoid yii complain the error/warning


is undefine index.

After fixed, the top menu appeared, but it behave incorrectly as shown at dynamicdrive dot com, the space between each menuitem seems like too width, when mouse hover over to next bottom menuitem, the menu behave like mouse already move out, and simply disappeared.

Can you please help and comment ?? I still new to Yii, and first to MVC framwork.

Leave a comment

Please to leave your comment.

Create extension