Page 1 of 1

Template or not to template that is the question

Posted: Thu Mar 03, 2005 10:22 am
by AGISB
For my current project I have now to decide wether I go with the current design or use a template engine. I search the web and it seems that there are many pro's and con's about it.

From what I gathered pro's can be:

- code are different different from design elements
- easier for biger projects
- caching of static pages

con's could be:

- longer execution time
- complex template structuring
- security issues due to possible search engine attacks


Now my current design basically includes the design elements but I use the code on the same script than the content. No problem as I am developping on my own. For most codeing I use OOP so there is not much code on the content pages.

So how much sense makes it for me to use something like smarty basically just for caching? How much overhead would the template engine build?

Posted: Thu Mar 03, 2005 10:27 am
by feyd
for the flexibility they offer, they add very little overhead. Depending on implementation, it can be very low to marginal increase in rendering time..

"search engine attack" is a new one that I have not seen or heard of.

Posted: Thu Mar 03, 2005 10:58 am
by AGISB
A search engine attack is when a search engine like google is used to find certain pages that are unique to a program that has a weakness. So the attacker finds all pages that use this program and use the exploit against any or all of them.

Posted: Thu Mar 03, 2005 11:08 am
by feyd
oh.. that.. template engines aren't alone in this "problem"

all users of any software that do not update often enough, or quickly enough have this issue.. If you write your own, you may have an issue similar to massively distributed ones, but the damage potential is, likely, far less.. (for other sites anyways)

That mostly has to do with your security programming..

Posted: Thu Mar 03, 2005 1:58 pm
by patrikG
purely from a server point-of-view: use some template engine to generate as much static content as possible. Static pages are much more easily cached than dynamic pages.

Re: Template or not to template that is the question

Posted: Thu Mar 03, 2005 5:39 pm
by Buddha443556
AGISB wrote:So how much sense makes it for me to use something like smarty basically just for caching?
Does not sound like you need a template engine but just caching? Do you need caching?

There's nothing wrong with using includes.