Cmenu

Hi everyone, I have a small problem with CMenu.

I would to have a two-levels menu where one item is like this one




            <li class="dropdown">

              <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="download">Download <span class="caret"></span></a>

              <ul class="dropdown-menu" aria-labelledby="download">

... <li>...</li>

[...items...]


              </ul>

            </li>



So I have




<ul>

    <li><a>label1</a></li>

    <li><a>label2</a></li>

    <li class="dropdown">

      <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="download">Download <span class="caret"></span></a>

      <ul class="dropdown-menu" aria-labelledby="download">

      ... <li>

      ...</li>

       [...items...]


      </ul>

    </li>

</ul>



My problem is to assign "dropdown" class in li element.




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

			'htmlOptions'=>array('class'=>'nav navbar-nav'),

			'items'=>array(

				array('label'=>'Home', 'url'=>array('/site/index'), 'active'=>(($this->id=='site')&&($this->action->id=='index'))?true:false),

				array('label'=>'One', 'url'=>array('/one'), 'active'=>$this->id=='one'?true:false),

				array('label'=>'Two', 'url'=>array('/two'), 'active'=>$this->id=='two'?true:false),

				array('label'=>'Three',

				      'url'=>array('#'),

				      'active'=>($this->id=='three')?true:false),

                                      'linkOptions'=>array('class'=>'dropdown-toggle', 'data-toggle'=>'dropdown'),

				      'items'=> array(

					  array('label'=>'Three.1', 'url'=>array('/three1')),

					  array('label'=>'Three.2', 'url'=>array('/three2')),

				      )

				 ),

				

			),

		));



Anyone can help me?

Thanks

Hi,

Here you can find your solution

http://www.yiiframework.com/forum/index.php/topic/7650-css-and-cmenu/

I believe CMenu items has a attribute


itemOptions


array('label'=>'Three',

                                      'url'=>array('#'),

                                      'active'=>($this->id=='three')?true:false),

                                      'linkOptions'=>array('class'=>'dropdown-toggle', 'data-toggle'=>'dropdown'),

                                      'itemOptions'=>array('class'=>'dropdown'),

                                      'items'=> array(

                                          array('label'=>'Three.1', 'url'=>array('/three1')),

                                          array('label'=>'Three.2', 'url'=>array('/three2')),

                                      )

                                 ),



this should do it

Yes! This one.

Thanks