Hey all,
I am trying to build and access query variables dynamically within a
template. Based on a count I need to access the value of a variable like
"li_2_product_name" and use it in a comparison statement.
This is the line than throws the syntax error. I there any way to reference
the variable cnt in the if statement?
I have tried these two options, but they both give me syntax errors:
[% IF li_[% cnt %]_product_name == product_name %]
[% IF li_${cnt}_product_name == product_name %]
This is the entire code segment to give you some context:
[% cnt = 1 %]
[% FOREACH line_item = line_items %]
<tr>
<td height="25" width="30%">
<select name="li_[% cnt %]_product_name">
[% FOREACH product_name = product_names %]
[% IF li_[% cnt %]_product_name == product_name %]
<option selected>[% product_name %]</option>
[% ELSE %]
<option>[% product_name %]</option>
[% END %]
[% END %]
</select>
</td>
</tr>
[% END %]
Thanks for your time,
Jerry
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates