If I put this in a single file:
[% USE DBI('DBI:CSV:f_dir=./tables;') %]
[% FOREACH row = DBI.query('SELECT * FROM tablename ORDER BY sortorder') %]
...then i get the output i want. but i don't want to have to have the "USE DBI" line in every individual template file.
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') %]
...
where file "common" has the line:
[% USE DBI('DBI:CSV:f_dir=./tables;') %]
but that doesn't work. i get the console warning: Use of uninitialized value in join or string at /Library/Perl/darwin-thread-multi/DBI.pm line 1273. and no rows are found.
However, if I put this in "common":
[% USE d = DBI('DBI:CSV:f_dir=./tables;') %]and this in the template:
[%INCLUDE common]
[% FOREACH row = d.query('SELECT * FROM tablename ORDER BY sortorder') %]
...
Then it works.Could someone explain what USE and SET do when they are used across INCLUDE/PROCESS, which explains this behavior?
-mda
_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
