In the latest version of web2py, this solution no longer works. There's no 
"web2py-menu-active" class. Is it now standard policy for web2py apps not 
to have menu selections highlighted?

Thanks.

On Monday, 17 October 2011 15:00:38 UTC-4, Paolo Caruccio wrote:
>
> If you're using respone.menu to build your menu and in line with 
> http://www.web2py.com/book/default/search?search=response.menu
> you could replace the second item (the boolean value)in the tuple with the 
> check (request.function=='index') where index is your active page.
> In this way web2py automatically add to li tag (your menu tab) the 
> class="web2py-menu-active". So in .css file you can customize it.
>
> For example (I'm using default w2p application "welcome"):
>
> ### in menu.py (welcome app models folder) ###
>
> response.menu = [
>     (T('Home'), False, URL('default','index'), [])
>     ]
>
> becomes
>
> response.menu = [
>     (T('Home'), (request.function=='index'), URL('default','index'), [])
>     ]
>
> ### in layout.html (welcome app views folder ###
>
> change this
>
> {{=MENU(response.menu,_class='sf-menu')}}
>
> to 
>
> {{=MENU(response.menu,_class='sf-menu',li_active="tab_highlighted")}}
>
> li_active allows to change default class "web2py-menu-active" to your 
> preference. In the above example "tab_highlighted".
>
> ### in base.css (welcome app static/css subfolder) 
>
> append the css rule
>
> .web2py-menu-active a, .tab_highlighted a{color:red}
>
> Ciao.
>
> Paolo
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to