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

Reply via email to