CMenu 'htmlOptions' property seem don't work....

Good morning guys,

I want to set the html id attribute for my CMenu root container tag, so

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

	'id' => 'usermenu',

	'items' => array(

		array('label' => Yii::t('menu', 'Register'), 'url' => array('/user/user/register'), 'visible' => Yii::app()->user->isGuest),

		array('label' => Yii::t('menu', 'Login'), 'url' => array('/user/user/login'), 'visible' => Yii::app()->user->isGuest),

		array('label' => Yii::t('menu', 'Hi') . ', ' . Yii::app()->user->name . ' ', 'visible' => !Yii::app()->user->isGuest),

		array('label' => Yii::t('menu', 'My account'), 'url' => array('/user/user/profile'), 'visible' => !Yii::app()->user->isGuest),

		array('label' => Yii::t('menu', 'Logout'), 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest)


	'htmlOptions' => array('id' => 'usermenu'),


but this is the result:

<ul id="yw0">

	<li class="active"><a href="/index.php?r=site/index">Home</a></li>

	<li><a href="/index.php?r=site/page&amp;view=about">About</a></li>

	<li><a href="/index.php?r=site/contact">Contact</a></li>

	<li><a href="/index.php?r=event/index">Events</a></li>


How should I change the <ul> id?


you just need the ‘id’=‘usermenu’, I tryed with Yii 1.1.4 and it works…

My apologies … I was looking at the html code in a different menu that I have below on my page… :rolleyes: Sorry!

Works fine!

What about <ul> inside <ul>? in dropdown cmenu

it doesn’t work…

‘htmlOptions’=>array(‘class’=>‘nav1’) works only for one level.