[SOLVED] CMenu & CSS

I am having problems having my CSS applied when a menu item links to a specific record.

Take the simple menu below, the CSS as defined in Menu works just fine for ‘Account’ but when I click on ‘My Account’ it doesn’t.


<div id="Menu">

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

        'items'=>array(

            array('label'=>'Account', 'url'=>array('/account/view'),  

				// CSS works fine

	    array('label'=>'My Account', 'url'=>array('/account/view/id/'.Yii::app()->user->id), 

				// CSS applied to active link does not work

            ),

        )); 

    ?>

</div>

CSS


#Menu ul li.active a {

	color: #CCC;

	text-decoration:none;

}

Any ideas???

Thanks

I suppose the CSS class "active" is not applied to the item. Try using the createUrl-method instead of


'/account/view/id/'.Yii::app()->user->id

hofrob

As I’ve just discovered you don’t need to use the createUrl-method. CMenu uses normalizeUrl:

You should press ctrl+u in the browser, an paste here the generated code…

I think the problem is in your routing rules in CUrlManager aka urlManager in components…

(you can also pase it here)

Yii just don’t recognize the url or something…

Solution is in this post.