CMENU external url?

Is there a way to have Cmenu return a regular URL or am i just making things more complicated than they need to be?

Here it is straight from the docs I wanna put an external pointing url in to the url array but it keeps generating a self referencing url to the current domain. Is there a way to work around that?

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


        // Important: you need to specify url as 'controller/action',

        // not just as 'controller' even if default acion is used.

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

        array('label'=>'Products', 'url'=>array('product/index'), 'items'=>array(

            array('label'=>'New Arrivals', 'url'=>array('product/new', 'tag'=>'new')),

            array('label'=>'Most Popular', 'url'=>array('product/index', 'tag'=>'popular')),


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



CMenu calls CHtml::normalizeUrl

That is, no array and it should work

(not tested)


If you wish to include an external URL just write the URL in the item:

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






Ok thanks I read that it calls normalize array but I guess I should have taken a look at exactly what it does instead of assuming.

You guys were both right and works fine now.

Christ!!! I am having an issue with this but I cannot include the code because I cannot include links in my first post.

let me describe my problem. I use the code as specified in the solution in this post, but instead of getting the URL I specify I get my sites URL with an ?r= and then the URL specified. I would love to include examples but the system won’t let me post them. I hope this makes sense.

?r= <— that is the normal default install… Have you check this nice wiki?


Thanks for the reply. So just to be clear, if you are not using friendly URLs you cannot link to an external site using CMenu, but if you use nice URLs then specifying an external URL will properly link off site?

You should specify an external URL without a surrounding array().


Tommy, thanks a bunch, that was totally my problem.