Stathy G. Touloumis wrote:
> Thanks for the response.  Can the Macro be called from other templates?

Better to make it a separate file, as Drew suggested.  Works the same.

> 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.

Well, you can certainly do that easilly enough:

[% months=my_months_function %]
[% INCLUDE dropdown option=months %]

The function could be passed in as a sub ref, could be a plugin, could 
be a regular module loaded via the LOAD_PERL option, etc.

However, I generally don't like that sort of "callback" programming 
style.  I used to do everything that way (years ago, in an ugly 
Java-based templating system), but these days I think that doing all the 
data fetching and decision-making up front is a better approach.  For 
something this small, it's kind of a moot point.

- Perrin



Reply via email to