Apache-SimpleReplace
view release on metacpan or search on metacpan
NAME
Apache::SimpleReplace - a simple template framework
SYNOPSIS
httpd.conf:
<Location /someplace>
SetHandler perl-script
PerlHandler Apache::SimpleReplace
PerlSetVar TEMPLATE "/templates/format1.html"
PerlSetVar REPLACE "the content goes here"
</Location>
Apache::SimpleReplace is Filter aware, meaning that it can be used
within an Apache::Filter framework without modification. Just
include the directive
PerlSetVar Filter On
and modify the PerlHandler directive accordingly. As of version
0.06, Apache::SimpleReplace requires Apache::Filter 1.013 or
better - users of Apache::Filter 1.011 or less should use version
0.05.
DESCRIPTION
Apache::SimpleReplace provides a simple way to insert content within
an established template for uniform content delivery. While the end
result is similar to Apache::Sandwich, Apache::SimpleReplace offers
several advantages.
o It does not use separate header and footer files, easing the
pain of maintaining syntactically correct HTML in seperate files.
o It is Apache::Filter aware, thus it can both accept content from
other content handlers as well as pass its changes on to others
later in the chain.
EXAMPLE
/usr/local/apache/templates/format1.html:
<html>
<head><title>your template</title></head>
<title>your template</title>
<body bgcolor="#778899">
some headers, banners, whatever...
<p>
the content goes here
</p>
<p>some footers, modification dates, whatever...
</body>
</html>
httpd.conf:
<Location /someplace>
SetHandler perl-script
PerlHandler Apache::SimpleReplace Apache::SSI
PerlSetVar TEMPLATE "templates/format1.html"
PerlSetVar REPLACE "the content goes here"
PerlSetVar Filter On
</Location>
Now, a request to http://localhost/someplace/foo.html will insert
the contents of foo.html in place of "the content goes here" in the
format1.html template and pass those results to Apache::SSI
The result is a nice and tidy way to control any custom headers,
footers, background colors, or images in a single html file.
NOTES
As of 0.02, TEMPLATE is no longer relative to the ServerRoot.
( run in 0.530 second using v1.01-cache-2.11-cpan-e1769b4cff6 )