Hello,
On 06/06/12 21:45 -0700, ozwyzard wrote:
> Hello,
>
> Is there a better way to construct the following without requiring two if
> statements for each tab item?
Yes, it is.
> Thanks!
> ----
>
> <py:def function="sidebar(tabname)">
> <div class="sidebar-nav">
> <ul class="nav-list">
> <li py:if='tabname=="TabOne"' class="active"><a href="#">TabOne</a></li>
> <li py:if='tabname!="TabOne"'><a href="#">TabOne</a></li>
> <li py:if='tabname=="TabTwo"' class="active"><a href="#">TabTwo</a></li>
> <li py:if='tabname!="TabTwo"'><a href="#">TabTwo</a></li>
> </ul>
> </div>
> </py:def>
IIRC you can use something like:
<li py:attrs='tabname=="TabOne" and {"class": "active"} or None'>
<a href="#">TabOne</a>
</li>
-- Jan
> --
> You received this message because you are subscribed to the Google Groups "Genshi" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/genshi/-/VFa6Nv4XZH4J.
> To post to this group, send email to
gen...@googlegroups.com.
> To unsubscribe from this group, send email to
genshi+un...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/genshi?hl=en.
>