When I see some people using or asking about templating systems and then as the conversation continues they don't seem to know why they are using them. That suprises me since I've always tried to follow a simple-is-best philosophy.
As I see it, from the perspective of using two packages and writing my own years ago, that templates have just a few specific uses.
The number one true use for templates is the one I hardly ever see people using anymore. Customisation is the real benefit of templates. My first system consisted of a single massive "directory handler" style CGI (later mod_perl) script that loaded various templates based on input and logged in user. The main template set had within it entire sections that were erased because the user had no permissions to use the tools they expressed. Better still, I could log in as a test user and work with an entire second set of templates and verify new features before anyone ever saw them or test template modifications without disturbing trained users.
The second big benefit that seems to be more popular these days is separation of display and action. Content vs. Code. This is usually only a real gain if there are a number of people working on a project or if the web design will predate the code design. Often, for the smaller systems I've seen discussed, being worked on by a single perl programmer, it would seem to be a useless detraction and dsitraction from a project. I see it as using Velcro to hold a car together. =)
The big gain that a lot of people see in templates that I don't particularly see is expression conciseness. They seem to look at it as turning HTML/CGI inside out. Rather than having a CGI with lots of prints delineated out special, they tend to write out the HTML and delineate the CGI code special. This is merely a comfort issue so I won't address it as positive or negative. The same work generally gets done though the price of doing it this way is often at complicating the webserver unnecessarily. Of course, if you already had to throw mod_perl or it's like at other problems, then you've paid the price already so o nuts. =)
Here are my two real questions: One, direct, are there other reasons you use templates that I missed or gains that I didn't state? Two, rhetorical, if you are about to use one template system or another do you know why?
--
$you = new YOU;
honk() if $you->love(perl)
In reply to Why use Templates at all? by extremely
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |