On 26 February 2013 00:04, Derek Hildreth <[email protected]> wrote:
> How might I apply this concept to a chameleon template? Is there a better,
> or more pythonic/pyramidic/chameleonic way of doing this other than
> 'if/then' statements within the template? I'm thinking it would be best to
> keep the view logic and view templates separate.
<ul tal:switch="current_page">
<li tal:case="'Home'">...</li>
<li tal:case="some_python_expr">...</li>
</ul>
But you'll probably want to use CSS through attributes such as:
<li class="${'selected' if page.is_current(request)}">
Lots of variations. Chameleon has a number of different ways to
implement them – it depends on the data structure that you use to
determine what the default page is.
Or you can use Javascript! There's endless variation to this theme.
\malthe
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.