Monks ~
For years I've created HTML template files and put then in the web server directory, in directories parallel to images, CSS files, and the like. Someone said to me a few days ago, "You know, if you think about it those templates are clearly config files. They shouldn't be served by the web server, and in fact belong somewhere like /var."
"Hmmm..." I thought.
On one hand this makes a lot of sense. The fact that the templates are more HTML than anything strikes me as incidental, a red herring. Jamie's mantra is: "If the file isn't designed to be served by the web server, it doesn't belong in a servable directory." And that's hard to argue with.
On the other hand, how much purity do we need? Lots of little web frameworks keep their template files in the server directory. I want to examine the problem a little more and get soem other perspectives.
Directories like "/var" are root-only, and keeping template files there means they're not editable by regular users. Some web apps are built to be installed and maintained by users in their home directories, and the server would need special setup to accomodate this. Slash installs its templates under "/usr/local", but it's a large framework and depends on the administrators having special permissions.
Configuration is another issue, closely related. What if a user wants to install multiple copies of the application and have each behave or look differently? One template repository is clearly not enough in this situation.
Lastly I worry about correctly configuring web server permissions. Slash gets around this by compiling all its Template templates into a database, so the webserver doesn't have to care where they are on the filesystem. If an application is in a user's home directory but you want to keep the template files away from the webserver, then you're looking at nastiness like http://cgiwrap.unixtools.org.
So here's what I can think of:
But this is just my perspective. What are some other ways of looking at this?
In reply to Where to keep HTML templates for a web application? by legLess
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |