Menu Bar

i want to know, how to add new menu item for menu bar…i do not understand how to set the URL path for it…please help me.


I hope this can help you

$user = Yii::app()->user; // just a convenience to shorten expressions


array('label'=>yii::t('en','create').' '.yii::t('en','Programm'), 'url'=>array('create'),'visible'=>$user->checkAccess('admin')),

array('label'=>yii::t('en','search').' '.yii::t('en','Programm'), 'url'=>array('admin'),'visible'=>$user->checkAccess('admin')),




$this->menu[] = array('label'=>'Go To Useradmin','url'=>array('user/index'));


hi sandu, you can write like this…

I am giving a example to you

	<div id="mainmenu">

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


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

				array('label'=>'REGULAR', 'url'=>array('/users/create'), 'visible'=>Yii::app()->user->isGuest), // path to view/users/create,  u can use visible option or can not 


				array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),   	// path to view/site/about

				array('label'=>'Contact', 'url'=>array('/site/contact')),     	//path to view/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)


		)); ?>

	</div><!-- mainmenu -->

And in controller set the access control rule for perticular action(means who r going to access that link or view)

I hope This will help u


i want to know how to create sub menu ?

thank you


Hi SAndhu,

Can u Take a look at the ‘NavBar’-Style of the superfish plugin:…erfish/#sample4

(click on ‘Examples’ after this url has been loaded)

It can easily be used within yii using the CDropDownMenu Extension.

This is a wrapper for the superfish plugin and can be set to ‘navbar’ style.

Or u can try like this…

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

        array('label'=>'Hot Deals', 'url'=>array('/company/aboutUs'),



            array('label'=>'SubItem1', 'url'=>array('site/anot','id'=>'12')),

            array('label'=>'SubItem2', 'url'=>array('site/anot','id'=>'13')),