How do I link a menu item to an external page?

Hi there,

I have two questions

  1. How can I create a link in a CMenu item to point to an external webpage instead of an action or view of my app?

  2. How can I make a CMenu item open the link in a new web browser page "_blank"?

Please help!



array(‘label’=>‘Blog’, ‘url’=>(‘’)),


Hi Fire

Read this:

By Example: CHtml


You pass


Hi! Thanks for your response, however I am still having problems,

here is my menu:

‘FBadminMenu’=>array( array(‘label’=>‘Home’, ‘url’=>array(’/site/return’)),

                                   array('label'=>'About', 'url'=>array('/help/about')), 

                                   array('label'=>'Store', 'url'=>array('/help/store')), 

                                   array('label'=>'Invite',  'url'=>array('/site/invite'),'htmlOptions'=>array('target'=>'_BLANK')),        

The target still doesn’t make it open in a blank page… any ideas what I am doing wrong?

check the generated html, if there is written something like:

<a href="..." target="blank">...</a>

It means that the menu did his work, and is your browser that doesn’t properly interpreate this property.

You need to use linkOptions, not htmlOptions:

array('label' => 'Invite', 'url' => array('/site/invite'), 'linkOptions' => array('target'=>'_blank')), 

THANKS! You saved the day!

Thanks for your great help!!!!

i created new menu ex:new_menu.

but i get new menu but url did not connect i got error

Home » Error

Error 404

The system is unable to find the requested action "new_menu".

my code is:



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

			array('label'=&gt;'About', 'url'=&gt;array('/site/page', 'view'=&gt;'about')),



			array('label'=&gt;'New Page', 'url'=&gt;array('/site/new_menu')),



			array('label'=&gt;'Contact', 'url'=&gt;array('/site/contact')),

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

array('label'=&gt;'Logout ('.Yii::app()-&gt;user-&gt;name.')', 'url'=&gt;array('/site/logout'),




pls give me solution


please change the menu actionname

array('label'=>'New Page', 'url'=>array('/site/newmenu')),

thenafter in your site controller create the actionNewMenu and redner the page

public function actionNewMenu(){

  //render page


please see it… more refrences


thanks for the help