Hello friends.
I have a problem, I want to link Student page in main menu. but cant understand its link .
please help.
Hello friends.
I have a problem, I want to link Student page in main menu. but cant understand its link .
please help.
something like :
<?php $this->widget('bootstrap.widgets.TbNavbar',array(
'items'=>array(
array(
'class'=>'bootstrap.widgets.TbMenu',
'items'=>array(
array('label'=>'Home', 'url'=>array('/site/index')),
array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
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),
array('label'=>'Student', 'url'=>array('/controler/action')),
),
),
),
)); ?>
Hello…
Thank you sir for your reply, but the student link is not working,
array(‘label’=>‘Student’, ‘url’=>array(’/controler/action’)),
Home, about & Contact etc have their Form link on site page, If I try Student_form, it give the error that un defined path…
if your controller name is StudentsController and want to link index action then did like this
<?php $this -> widget( 'bootstrap.widgets.TbNavbar' ,array (
'items' => array(
array (
'class' =>'bootstrap.widgets.TbMenu' ,
'items' =>array (
array ( 'label' => 'Home' , 'url' =>array ( '/site/index' )),
array ( 'label' => 'About' , 'url' => array ('/site/page' , 'view' =>'about' )),
array ( 'label' => 'Contact' , 'url' =>array ( '/site/contact' )),
array ( 'label' => 'Student' , 'url' =>array ( '/students/index' )),
),
),
),
)); ?>
if your controller name is different use name of the controller in small letter. excluding the controller word. and write the name of the action in small letter excluding the action word
Thank u so much, it works, but a bit problem here,
As I added the student in the main menu, and logged in, so after login the main menu elements( Home, About Us etc) become disappear,
why is it so??
I think you are using visible property for each elements to show only when the user is guest, remove that property. if it is wrong. post you menu code.
by analysing your screenshot there is no problem here but I dont know what is the problem here. I think it may uses different layout for authenticated users
May be… but now i download side bar, and link student, admin pages there rather then main menu,
Ok for side bar if I want it should display on every page, I have to write the code in every page??
because now its displaying only on main menu…
check the $layout property of your controller
download this pre configured bootstrap application from here I used this application to quick start using bootstrap in yii and just change the menu accordingly to your need