Submenu Options In Cmenu

In the below code linkOptions , submenuOptions , itemOptions are not working. Also how do i prevent encoding of a single item not entire menu


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

	'items'=>array(

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

		array('label'=>'Users', 'url'=>array('/users/index')),

		array('label'=>'Products', 'url'=>array('/products/index')),

		array(	

			'label'=>'Details<b class="caret"></b>', 

			'url'=>'#', 

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

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

			'submenuOptions '=> array('class'=>'dropdown-menu'),

			'items'=>array(

				array('label'=>'Info', 'url'=>array('/Product/info')),

				array('label'=>'options', 'url'=>array('/Product/options'))

			)

		)

	),

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

)); ?>

There is no such thing like submenuOptions. I think you’re talking about submenuHtmlOptions. Correct your code and check, if the problem has been solved.

CMenu is generally a very poor menu system. It is mainly designed as a base widget for extending it by a developers. Consider using something else instead. There are many Yii menu extensions. From simple one (I tested MbMenu and found it very nice) to a whole widget sets, which include menu, like Bootstrap or others.

Thanks For the reply but this too didn’t work. I think i will stick to simple html. I don’t want to use a extension for this

Well… I think that even CMenu should have a good support for styling/classing submenus.

If you’re sure, that this is a bug, the post in Bug Discusions forum or open a issue at Github to report it.

awebdeveloper, I am doing the same thing what you and i found the solution; you need add ‘encodeLabel’ => false to your first items array.

My code look that:




$arrMenu = array(

    'id' => 'nav',

    'encodeLabel' => false,

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

    'items' => $arrItems,

);


$this->widget('zii.widgets.CMenu', $arrMenu);