Andrew Hardie wrote:
> I am contructing HTML tables in TT, but the calculation for each table
> row is complicated so, to keep code away from HTML, I want to use a
> "subroutine" to be called for each table row and return variables for
> each column value, which will keep the table template very clean.
> Ideally, I would like the subroutine in a separate file, as I have
> about a dozen templates that need to share the same row generating
> code.
> 
> My question is, which is the right/best TT directive to use? I am
> getting a bit confused between INCLUDE, PROCESS, MACRO, WRAPPER, etc.

Are you just trying to figure out how to bundle up a chunk of template 
and call it multiple times?  In that case, PROCESS is most commonly the 
option you want.  Use INCLUDE only if you need to isolate the current 
state of the template variables so they can't be changed inside the 
included template.  Use MACRO if you have a really tiny thing that 
doesn't merit a separate file.

- Perrin


_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://www.template-toolkit.org/mailman/listinfo/templates

Reply via email to