Hello template people.
Here is my Perl script for generating stub files in a src subdirectory
using a Template Toolkit Datafile as the driving structure.
The filter redirect() is either broken or the manual pages need to show
how to set OUTPUT_PATH. Using redirect(), I always got OUTPUT_PATH not
set.
The problem I am solving is how to generate a bottom layer of 10 or 12
pages that I am creating from data entries in a datafile.
[%# Template Toolkit script
Generate in src stub "html" files containing a text keyword.
Lee McKusick 4/5/2006
%]
[% USE items = datafile('lib/itemnames') %]
[% FOREACH item = items.sort("ititle") %]
[% itemidforperl = item.itemid %]
[% itemtitleforperl = item.ititle %]
[% itemidforperl %] is the id
[% itemtitleforperl %] is the title
[% PERL %]
print "[% itemtitleforperl %] is the title\n";
print "[% itemidforperl %] is the id\n";
open(SINK, "> src/item/[% itemidforperl %]\.html") or
die "Couldn't open [% itemidforperl %] for writing: $!\n";
print SINK "[% itemtitleforperl %]\n";
close(SINK);
[% END %]
[% END %]
|