Hi Paul
Thanks for that. I've got my own simple template parser. I say simple, because it is very simple. I don't paticulary see the need for a module overhead.
Code:
sub parse_template {
# --------------------------------------------------------------------------
# Sub to generate and print a template to the browser.
#
# check to see if we need to bypass printing a header. this is
# passed to use from the error_sub.
my $bypass_header = $_[1];
print $query->header() unless $bypass_header;
# find out which template should be displayed - this is either passed from
# another sub or from the browser.
my $pg = $_[0] || $query->param('pg');
my $file = $PATH_TEMPLATE . $pg;
# slurp the entire file into $HTML using $/ to enable slurp mode.
my $HTML;
{ local $/;
open (FILE,"<$file") || &error_html("Could not open $file. $!");
$HTML = <FILE>;
close FILE;
}
# do the template parsing. this replaces all <%..%> tags with the
# equivalent value in the hash %tmpl.
$HTML =~ s/<%(\w+)%>/$tmpl{$1}/g;
print $HTML;
}
Very very simple :-)
Now what I need is some e-commerce cookie thing as a replacement for my current bookshop:
http://www.fbagroup.co.uk/bookshop/ You know of any that support templates?
- wil