Yii 1.1.1 CMenu problem

I have write a new model called product, and CRUD of it.

In the cmenu list I write a product item, but when I clicked, it’s not show active class, but the default action works like the contact item.

Here’s the code

<div id="mainmenu">

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


				array('label'=>'index', 'url'=>array('/site/index')),

				array('label'=>'product', 'url'=>array('/product')),


				array('label'=>'contact', 'url'=>array('/site/contact')),


		)); ?>


the index url and contact url work fine, but product not.

Could it be this? The active class attribute got moved from the a element to the wrapping li in the 1.1.1 upgrade. OK, I’ll read the whole question this time. Sorry, I don’t know,.

array(‘label’=>‘product’, ‘url’=>array(’/product/index’)),


array(‘label’=>‘product’, ‘url’=>array(’/product’),‘active’=>$this->id==‘product’ ? true : null),

Thank you very much!


Hi - Im having same problem but solution didnt work for. Im new to Yii and am trying to add new menu to customer as main programmer is on vacation. my new lines in bold below.

code snippet (menu.php)

class menu extends CWidget { …

&#036;this-&gt;widget('zii.widgets.CMenu', array( 'items' =&gt; array(

          array('label' =&gt; 'Home', 'url' =&gt; array('/site/index')),

          array('label' =&gt; 'Members', 'url' =&gt; array(''),

                  'items' =&gt; array(

                  [b]array('label' =&gt; 'My Stuff', 'url' =&gt; array('/user/user/mystuff')),[/b]

                  array('label' =&gt; 'Account', 'url' =&gt; array('/user/user/account')),

	[b]'activateItems'=&gt;array('label' =&gt; 'My Stuff', 'url' =&gt; array('/user/user/mystuff')),[/b]                       ),

i copied account.php to mystuff.php but when i click in My Stuff, it does not find it.

Thanks in advance for any help.