okay, so now the bitwise *and *is giving me problems:

<input class="radio" type="radio" name="recipe_type" value="Warmup" [%
'checked="1"' IF 15 && 16 %]/>Warmup

incorrectly (I think) turns into

<input class="radio" type="radio" name="recipe_type" value="Warmup"
checked="1"/>Warmup

15 = 0000 1111
16 = 0001 0000

last time I checked, 15 & 16 = 0

Adding parenthesis didn't help either: [% 'checked="1"' IF (15 && 16) %]

Also, is there some way TT can interpret numbers as hexadecimal (e.g. 16 =
0x10)?

Thanks!

On Fri, Dec 5, 2014 at 9:37 AM, Simon Amor <si...@leaky.org> wrote:

> On 5 Dec 2014, at 14:38, Bill McCormick <wpmccorm...@gmail.com> wrote:
>
> > I'm trying to find a slick way to make my radio buttons checked. Doing
> something like ...
> >
> > [% IF flags && 16 %]
> >   <input class="radio" type="radio" name="recipe_type" value="Warmup"
> checked="1" />Warmup
> > [% ELSE %]
> >   <input class="radio" type="radio" name="recipe_type" value="Warmup"
> />Warmup
> > [% END %]
> >
> > ... just seems wrong.
> >
> > Suggestions?
>
> This is my preferred way of doing it. It doesn't have as many [% %] tags
> as other options which IIRC makes it a little faster than keep swapping
> between TT and HTML, and it doesn't require the END.
>
>   <input class="radio" type="radio" name="recipe_type" value="Warmup"[% '
> checked="1"' IF flags && 16 %] />Warmup
>
> Regards
>
> Simon
_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to