First template attempt: how to INCLUDE a list of subfiles?
Michael Friendly <[email protected]> Fri, 14 Dec 2012 15:09:07 -0500
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Organization | York University |
| Message-ID | <[email protected]> |
This is my first attempt to use the Template system & tpage to refactor
some old
web pages to make them more flexible for further development.
The web page I'm working on is at
http://www.datavis.ca/gallery/missed.php
and I simply want to generate each of the table rows from a template
file, that looks like that below.
There's probably something very basic I'm missing, but the lines
[% FOREACH item IN items %]
[% INCLUDE item %]
[% END %]
produce no output in the tpage generated file.
%------------- missed.php.tpl ----------------------------------
[% INCLUDE header.php.tt
pagetitle = Missed Opportunities and Graphical Failures
items = [
"missed-nasa1.item"
"missed-nasa2.item"
"missed-nasa3.item"
"missed-playfair.item"
"missed-happiness.item"
]
%]
<h2> <img src="icons/thumbdn.gif" width="25" height="19" />
<a name="MissedOpportunities">Missed Opportunities and
Graphical Failures</a>
</h2>
<div class="precept">
One virtue of a good graphical display is to allow us to see
patterns,
trends, or other structures which would otherwise be concealed
in another
form of display.
It may be heartbreaking to find out that some important information
was there, but the graph maker missed it.
The story behind the <em>Challenger Disaster</em> is perhaps
the most poignant
missed opportunity in the history of statistical graphics.
But such graphical failures often provide useful lessons.
</div>
<p>
<table border="1">
<tr bgcolor="#FFFFC0">
<th width="160">Picture</th>
<th>Words</th>
[% FOREACH item IN items %]
[% INCLUDE item %]
[% END %]
</table>
[% INCLUDE footer.php.tt %]
--
Michael Friendly Email: [email protected]
Professor, Psychology Dept.
York University Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele Street http://datavis.ca
Toronto, ONT M3J 1P3 CANADA