Thanks for the response.  Can the Macro be called from other templates?
Normally we do pass the data which creates the dropdown but since there are
only a few dropdown subsets it would be ideal to not have to always pass the
data to the macro or template from the calling code.   It would be
preferable to have these 'widgets' or macro's draw the data independently as
opposed to requiring the calling template/code to pass the data to them. Let
me know if I need to be more explicit : )

> > 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 %]



Reply via email to