kaelwithme
(Kaelwithme)
September 29, 2010, 8:11am
1
i read in the documentation that the CMenu widget automatically assigns a class=“active” to a currently active item. when i view the selection’s source, i don’t see any class=“active” in any of my menu items. i think it’s not working or something. i need this to set a background image for an active link via css. i already have .active ul li{color:#F00 ;} in my css file but it doesn’t show anyhow. pls help… thank you
Each
(Rikius)
September 29, 2010, 8:15am
2
i read in the documentation that the CMenu widget automatically assigns a class=“active” to a currently active item. when i view the selection’s source, i don’t see any class=“active” in any of my menu items. i think it’s not working or something. i need this to set a background image for an active link via css. i already have .active ul li{color:#F00 ;} in my css file but it doesn’t show anyhow. pls help… thank you
recheck your css file. i think you don’t have that structure of active element.
.active ul li{color:#F00;}
kaelwithme
(Kaelwithme)
September 29, 2010, 8:18am
3
well for starters, it is documented that CMenu assigns the ‘active’ class on an li.
and i do have that kind of structure…
zaccaria
(Matteo Falsitta)
September 29, 2010, 9:28am
4
Hi Kael.
Cmenu assigns authomatically only if the path is the same of the url property.
If, for example, you have the url set to array(‘controllerId’) and the page called is controllerId/index, CMenu will not assign this property.
For make it work, there is the property ‘active’.
You can set:
'url'=>'user'
'active'=>$this->uniqueId=='user'
Like that the link will be active for all actions of the controller userController (uniqueId is the indentificator of the controller).
For debug, I advice you to choose an item in the menu and write:
'active'=>true
so you can easily check your css. After it you can try to make it dynamic
kaelwithme
(Kaelwithme)
September 29, 2010, 9:32am
5
zaccaria:
Hi Kael.
Cmenu assigns authomatically only if the path is the same of the url property.
If, for example, you have the url set to array(‘controllerId’) and the page called is controllerId/index, CMenu will not assign this property.
For make it work, there is the property ‘active’.
You can set:
'url'=>'user'
'active'=>$this->uniqueId=='user'
Like that the link will be active for all actions of the controller userController (uniqueId is the indentificator of the controller).
For debug, I advice you to choose an item in the menu and write:
'active'=>true
so you can easily check your css. After it you can try to make it dynamic
hi Zac! thank you very much!!! pretty much the answer i needed.