[Templates] isolating "USE DBI" in single common file?

Andy Wardley abw@andywardley.com
Mon, 6 Oct 2003 13:11:04 +0100


Mark Anderson wrote:
> rather, i'd like to be able to INCLUDE or PROCESS a file like this:
>  [%INCLUDE common]
>  [% FOREACH row = DBI.query('SELECT * FROM tablename ORDER BY sortorder') %]

That should be:
  [% PROCESS common %]

If you INCLUDE it then any variables (including plugins) defined in the
common template remain local to it.  Use PROCESS so that variables are
"exported" into the calling template.

Also, see the PRE_PROCESS option.  This will automatically add it to all
your template pages.

A