CMenu Widget!

CMenu

Simply i want to create a vertical menu on the left

How to convert the following html


<nav>

    <a class="scroll" href="#destination1">Destination 1</a>

    <a class="scroll" href="#destination2">Destination 2</a>

    <a class="scroll" href="#destination3">Destination 3</a>

    <a class="scroll" href="#destination4">Destination 4</a>

</nav>



TO CMenu Widget?





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

    'items'=>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')),

        // 'Products' menu item will be selected no matter which tag parameter value is since it's not specified.

        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),

    ),

));



whenever i scroll down, the menu navigation should also move along with the page

hi !

I can’t help you with the scroll but if you want translate your actual html code in to Cmenu Widget you need to :

1 : read this documentation : http://www.yiiframew…c/api/1.1/CMenu

follow an exemple with your values




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

    'items'=>array(

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

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

        array('label'=>'Destination 1', 'url'=>array('your/path/to/your/fileview')),

    	array('label'=>'Destination 2', 'url'=>array('your/path/to/your/fileview')),

   	

));



Don’t forget to define your action in your controller !

How to apply class attribute to <a href??

as you can see I have <a href="scroll >

if you read the documentation you have the answer !!

look : http://www.yiiframework.com/doc/api/1.1/CMenu#htmlOptions-detail

exemple :




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

    'items'=>array(

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

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

        array('label'=>'Destination 1', 'url'=>array('your/path/to/your/fileview')),

        array('label'=>'Destination 2', 'url'=>array('your/path/to/your/fileview')),

   'htmlOptions'=>array('class'=>'scroll')    

));