Active state for items in Cmenu

Hi all,

I had something which worked well. I have kept the main menu in layouts/main.php and then the current state of items worked.

Now, I have moved the CMenu widget in layouts/Column2.php to be present in the column

And then the current states do not work anymore.

I look doc and forum but I still unable to understand why and to solve this problem

I would like the CMenu works has it did when it was in main.php layout

Have you got an Idea ?

Thanks





'active'=> ((Yii::app()->controller->id=='courses') && (in_array(Yii::app()->controller->action->id,array('update','view','admin','index'))) ? true : false) 




Thanks Rajith, but where I’m intended to put this code ?

like this ,in items array




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

			'encodeLabel'=>false,

			'activateItems'=>true,

			'activeCssClass'=>'list_active',

			'items'=>array(array('label'=>t('Create Courses'), 'url'=>array('courses/courses/create'),

							'active'=> ((Yii::app()->controller->id=='courses') && (in_array(Yii::app()->controller->action->id,array('update','view','admin','index'))) ? true : false)           

Ah…Ok thanks Rajith

Works very well with


Yii::app()->controller->action->id

to catch action in a single controller

yes thats it.