Template Engines

Here’s an interesting article, Template Engines from the author of bTemplate.

In short, the point of template engines should be to separate your business logic from your presentation logic, not separate your PHP code from your HTML code.

That’s the short definition of what a template should do. I think it should also:

  1. Provide application and server security. It could be argued that PHP safe_mode provides a level of security against third-party code.
  2. Make it simple to maintain the template.

In my experience, Smarty syntax is clearer in a html template. Mixing php and html grates on my brain but obviously it’s a subjective matter that many people are happy with.
Nevertheless, if you’re sitting on the fence about using templates, read the above article. See what the author does in his examples, and make up your own mind if they’re useful or not. You might find yourself using Smarty afterwards anyway!

Leave a Reply

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close