in reply to substituting strings in HTML with text files
Just create a template like this
template.tmpl<html> <head> <title>HTML File</title> </head> <body> [% INCLUDE 'events.txt' %] </body> </html>
The perl code looks like this
use Template; use CGI; my $q = CGI->new(); my $t = Template->new({INCLUDE_PATH => 'template/'}); $t->process('template.tmpl') or die "Template process failed: ", $t->e +rror(), "\n";
You can even put logic inside the template
... [% IF var = 'what I want' %] [% INCLUDE 'this_file.tmpl' %] [% ELSE %] [% FOREACH x = myarray %] <tr><td>[% INCLUDE x %]</td></tr> [% END %] [% END %] ...
| Just me, the boy and these two monks, no questions asked. |
|
|---|