I've come back to using TT2 after not having used it for a while, and I'm
running into a problem with the ?: operator. Take the following snippet:
[% FOREACH sev IN [1 .. 5] %]
<li class="[% $sev == 5 && data.by_sev.$sev > 0 ? 'red' : '' %]">
[% data.by_sev.$sev %] severity [% sev %]
</li>
[% END %]
What I want, is to see 'class="red"' when the value of "sev" is 5 AND when the
value of data.by_sev.$sev is greater than 0. However, I'm not getting this, the
trinary never comes up true. Since I see output like:
* 11 severity 5
It seems clear that the value of sev was 5, and the value of data.by_sev.$sev
was greater than 0.
I've tried various types of grouping with parens, and have had no luck in
getting the correct output. Anyone see anything obvious that I'm missing?
Randy
--
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray Sunnyvale, CA http://www.rjray.org [email protected]
Silicon Valley Scale Modelers: http://www.svsm.org
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates