Hi there,
I have two questions
-
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?
-
How can I make a CMenu item open the link in a new web browser page "_blank"?
Please help!
Thanks
Hi there,
I have two questions
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?
How can I make a CMenu item open the link in a new web browser page "_blank"?
Please help!
Thanks
Hi Fire
Read this:
By Example: CHtml
You pass
array(‘target’=>’_blank’)
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:
$this->widget(‘zii.widgets.CMenu’,array(
'items'=>array(
array('label'=>'Home', 'url'=>array('/site/index')),
array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
array('label'=>'New Page', 'url'=>array('/site/new_menu')),
array('label'=>'Contact', 'url'=>array('/site/contact')),
array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'),
'visible'=>!Yii::app()->user->isGuest)
),
));
pls give me solution
Hi,
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
thanks for the help