Here's an example from the most basic form of 'templating' available.
Server side includes. Assuming an Apache server configured to use SSI's
and given a Perl program that counts the number of times a page has been
fetched, called counter.pl, adding the following to your SSI enabled
HTML page (/index.html for example):

<!--#include virtual="/cgi-bin/counter.pl" -->

Which will replace that HTML comment with whatever counter.pl outputs.
Other than the SSI formatted comment, there is no code in the HTML page.
It's all in counter.pl. I've used this very simple form of code
separation to give clients who can maintain their own HTML but need some
very simple code generated content in certain pages the ability to do
that easily. All they need to do is place a comment like above where
they want it.

Except in cases where a site or set of pages are going to be generated
entirely in mod_perl or by CGI (in a lot of my work the asthetics are
far less important, and there will never be anyone maintaining just HTML
code), the above level of nearly complete separation is my personal
ideal. In cases where the response is generated with my code, outputting
the HTML is always the very last task and is done in one piece, the only
'code' allowed in that section are variables to be interpolated.
Frequently even then I maintain and work on the HTML as a stand alone
file which I can view, tweak and validate separate from the code.

Yeah, I really need to take a some time aside and try out
Template::Toolkit.

-- 
Sean Patrick Quinlan
[EMAIL PROTECTED]

Tired of spyware? Wish there was a better, more secure way to browse
the internet? There is, Firefox! And it's free!
http://www.getfirefox.com

Attachment: signature.asc
Description: This is a digitally signed message part

 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to