Smenu | How to make the Parent Menu item active

Hi dears,

I am using the SMenu for the menu of my application.

I want to make the top menu active if the sub menu item is being active.


if in the menu list there are

Main ->

    sub 1

    sub 2

and if the user is on the page sub 2

then the top menu Main should be set active.

Please help me in it.


I have done it using CMenu.

I modified the CMenu such that it fits in the required domain.


Could you please explain how you did that?

We can have it using the Active property of the Cmenu

If we have a items in our sub menu which belongs to the different controllers then we can use a custom code as fellow to have our top menu item active






Now in your CMenu widget, we can have

			$this->widget('zii.widgets.CMenu', array(




This is just a trick to get what I want.

It could be Improved.

Hopefully, will help someone.


Hi All,

As described here

normally, to make parent menu item active (by ‘active’ i mean that when you are on , Page in main menu should be also with class=‘active’)

it is enough to simply pass parameter ‘activateParents’=>‘true’ in a CMenu widget

But it is still not working.

Does anyone know where the problem is?

Thanks in advance,