in reply to Using a template
There are lots of good templating tools for use in CGI scripts too. Take a look at my article on this subject.