Stathy G. Touloumis wrote:
> As a very simple Example . . .
>
> -- In main template --
> <html>
> [% INCLUDE dropdownMonth %]
> </html>
>
> -- In dropdownMonth template --
>
> <select name="birthdate">
> [% monthL = getMonthArray() %]
> [% FOREACH m = monthL %]
> <option value="[% m.id %]">[% m.name %]</option>
> [% END %]
> </select>
Use a macro.
Have your main program look up that data before running the template and
pass it in as part of the template data. Then make a macro for
dropdowns, which accepts a parameter of the data to display.
[% MACRO dropdown %]
[% FOREACH option = options %]
<option value="[% option.id %]">[% option.name %]</option>
[% END %]
[% END %]
[% INCLUDE dropdown options=months %]
- Perrin