On Sun, Dec 16, 2012 at 8:03 PM, Michael Parker
<[email protected]> wrote:
> And use that in the footer? Or is there a more elegant solution I can use
> where the conditional to generate the class attribute or not is "inline" on
> the list item element?

There is actually a section in the jinja2 docs that shows how to do this:

http://jinja.pocoo.org/docs/tricks/#highlighting-active-menu-items

It's pretty close to what you've got, but this is a little shorter
than the conditional you wrote:

<li {% if name == selected_name %}class="selected"{% endif %}><a
href="{{ url_for(name) }}">text</a></li>

I've always liked doing this kind of thing in javascript, since it has
more to do with the behavior of the page and doesn't need to be done
by the template language.

-Steve

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" 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/pocoo-libs?hl=en.

Reply via email to