A Way To Make Cmenu Top-Level Item Unselectable?

The topic kind of says what I’m trying to get to. So for example if have this:




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

    'items'=>array(

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

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

    ),

));



Is there a way to make the top-level ‘Products" menu item un-selectable. In instance the Products top-level is just a label for the items that sit below and shouldn’t do anything. Cant’ seem to figure out how to make this work this way.

Much appreciate your help with this.

–

Chris

As per I understand your problem you want to remove product as a link,

so for that cchange you product menu like this,




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

        ), 'itemOptions'=>array('id'=>'product')),



and in your this view file on top write following script




<script>

$(document).ready(function () {

$('#product a').click(function(){ 

	return false;

});

});

</script>




That’s what I was looking for. Thanks so much!