I think it would be something like: <li class="defaultClass" tal:attributes="class 'selectedClass' if a==b else 'default' ">
regards, Gustavo. On Sun, Aug 21, 2011 at 11:31 AM, Benjamin Sims <[email protected]> wrote: > I'm trying to do something which I think should be pretty straightforward, > but I'm having trouble pinning down the exact syntax and would appreciate > any tips: > > I have a static navigation menu consisting of a basic list. The list should > 'know' which page it is on and display that particular list item with it's > own class to indicate it as the current page. For example: > > <li class = "default">Unselected page</li> > <li class = "selected">Current page</li> > <li class = "default">Unselected page</li> > > I would like to be able to do something along the lines of the following > pseudo-code: > > <li class = "defaultClass" tal:attributes="class 'if route_name = this_route > return selectedClass else return default'"> > > I've referred to > http://chameleon.repoze.org/docs/latest/reference.html#tal-attributes and > also http://www.owlfish.com/software/simpleTAL/tal-guide.html. However, I > can't quite find the syntax I want. Is there a way to achieve this simply, > or am I going about it the wrong way? > > I understand that I can wrap the <li>s in <tal:condition>, but this seems > cumbersome. > > Thanks, > Ben > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
