| Next: Example header and footer templates Previous: What is the Template Toolkit? Contents: Index |
A document is a plain text file usually containing other content (e.g. HTML, XML, RTF, LaTeX, etc). Here's an example of an HTML document with additional Template Toolkit directives.
[% INCLUDE header
title = 'This is an HTML example'
%]
<h1>Some Interesting Links</h1>
[% webpages = [
{ url => 'http://foo.org', title => 'The Foo Organization' }
{ url => 'http://bar.org', title => 'The Bar Organization' }
]
%]
Links:
<ul>
[% FOREACH link = webpages %]
<li><a href="[% link.url %]">[% link.title %]</a>
[% END %]
</ul>
[% INCLUDE footer %] |