Yii Framework Forum: Seting Lastitemcssclass Only For Parent Menu - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Seting Lastitemcssclass Only For Parent Menu Rate Topic: -----

#1 User is offline   deli6z 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 01-December 12

Posted 21 March 2013 - 10:27 PM

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!
0

#2 User is offline   seenivasan 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 620
  • Joined: 17-June 12
  • Location:Chennai,TamilNadu,India.

Posted 22 March 2013 - 06:10 AM

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

0

#3 User is offline   deli6z 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 01-December 12

Posted 22 March 2013 - 08:40 PM

View Postseenivasan, on 22 March 2013 - 06:10 AM, said:

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!!!
0

#4 User is offline   seenivasan 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 620
  • Joined: 17-June 12
  • Location:Chennai,TamilNadu,India.

Posted 24 March 2013 - 01:11 AM

Dear Friend

You can declare the submenuOptions in main item.
0

#5 User is offline   deli6z 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 01-December 12

Posted 24 March 2013 - 03:30 PM

View Postseenivasan, on 24 March 2013 - 01:11 AM, said:

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!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users