Adding id and classnames to CMenu
We use the id andhtmlOptions to accomplish this. Watch.
//in your view
$this->widget('zii.widgets.CMenu',array(
'id'=>'myMenu',
'items'=>$this->myMenu,
'htmlOptions'=>array('class'=>'span-24last'),
));
this will make Yiirender
<ul class="span-24 last"id="myMenu">
...
</ul>
Adding class names to CMenu items and CMenu item links
We use itemOptionsand linkOptions for this. Example.
//in your controller
$this->myMenu =array(
'id'=>'myMenu',
'items'=>array(
array(
'label'=>'Home',
'url'=>array('site/index'),
'itemOptions'=>array('class'=>'visited'),
'linkOptions'=>array('class'=>'bar'),
),
array('label'=>'Sign Out','url'=>array('site/signout')),
),
);
This will let Yii render
...
<ulid="myMenu">
<li class="visited">
<a class="bar"href="/site/index">Home</a>
</li>
...
原文地址:http://www.cnblogs.com/zaric/archive/2012/10/18/2729324.html
其他配置: