Yes but that only works in the earlier "welcome" scaffold shipped with web2py 1.79.x or so.
The latest web2py's "welcome" uses SuperFish menu ( http://users.tpg.com.au/j_birch/plugins/superfish/ ), which is supposed to be capable for that too, but in fact the out-of-box welcome/static/base.css losts a necessary definition: .web2py-menu-active a { background-color: white; } Besides, the latest welcome/static/base.css also losts .warn, .info, .error, they are supposed to be used in the scenario such as: response.flash = DIV('everything is good', _class='info') response.flash = DIV('sth is wrong but I can hang on', _class='warn') response.flash = DIV('fatal error', _class='error') The point here, is that what features in base.css are supposed to be maintained, and what else are subjected to change without notice? Regards, Iceberg On Aug 4, 3:59 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > The <ul>...</ul> code in Django in web2py translates with > > {{=MENU(response.menu)}} > > where (using the data in your example) > > response.menu=[ > ('Home',request.function=='home',URL(r=request,f='home'),[]), > ('Store Information',request.function=='info',URL(r=request,f=info'), > []), > ] > > The latter code can go in menu.py but you can place it in any mode. > MENU(...) takes arguments that allows you to customize the class of > the <ul> amd <li>. It also handles submenu (the [] above are > submenus). > > On Aug 3, 4:38 pm, mwolfe02 <michael.joseph.wo...@gmail.com> wrote: > > > > > I wrote this simple website using Django (http://www.heberlings.com/). As > > part of the navigation, I wanted to turn off > > the link for the currently active page. If you visit the site and > > click on a couple of the menu items on the left side of the page, you > > will see what I mean. > > > To implement this in Django, I did the following in my base.html view > > (or as Django calls it, template): > > > <!-- Start of left-hand side navigation --> > > {% url heb-home as url_home %} > > {% url heb-info as url_info %} > > ... > > <div id="nav"> > > <ul> > > {% ifequal request.path url_home %} > > <li id="current">Home</li> > > {% else %} > > <li><a href="{{ url_home }}">Home</a></li> > > {% endifequal %} > > {% ifequal request.path url_info %} > > <li id="current">Store Information</li> > > {% else %} > > <li><a href="{{ url_info }}">Store Information</a></li> > > {% endifequal %} > > ... > > > I always felt this was kludgy and I had trouble getting it to work > > just right. (Note: I did this a couple of years ago, things may have > > changed in Django since then.) > > > My question is this: how would I do this sort of thing in web2py? > > Should I implement this in models/menu.py? What is the best practice? > > > Thanks in advance, > > Mike