Seting Lastitemcssclass Only For Parent Menu

Hi everybody. I’m new to yii so please don’t judge.

I’m trying to figure CMenu and setting a lastItemCssClass to the main menu. Although it gets set to the sub menu last item as well what is not expected. Is there a way to prevent this behaviour?

Thank you for response in advance!

Dear Friend

Rather than assigning a class to the property lastItemCssClass, we can manually declare it in itemOptions.




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("class"=>"last")),



Thank you for help, that worked! Since it’s related there is another question: how to set a class for <ul> element? Actually submenu’s one. Thank you!!!

Dear Friend

You can declare the submenuOptions in main item.

both itemOptions and submenuOptions are described in official documentation but I,somehow, missed it, my bad guys!

Thanks for help!