Question

I'm rendering this Cmenu but the active class isn't showing on the li element when we are active on that menu page.

$this->widget('zii.widgets.CMenu', 
     array('items'=>array(
         array(
           'label'=>'Foo',
           'url'=>array('event/index/21')
         ),
         array(
            'label'=>'Bar',
            'url'=>array('event/index/22')
         )
       )
      )
 );

Does anyone knows why ?

Was it helpful?

Solution

'url'=>array('event/index', array( 'event' => '21' ))

This works.

It seems that it's the routes that need to match for the active class to kick in.

ref: http://www.yiiframework.com/forum/index.php/topic/23317-cmenu-item-not-active-any-more-after-i-used-url-cheating/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top