PHP vs template engine

phptemplates

I'm currently having a discussion about the choice between PHP as a template engine versus a template engine on top of PHP.

What is your choice, and why?

I say why use another template engine when PHP is a template engine itself.

Best Solution

For template engines:

  1. Added security for end-user customization. Themes in pure PHP have unconstrained ability to cause harm to a user and their installation. Thus a template engine removes that risk, if it is a good one.
  2. Ease of use for non-programmers, such as graphic artists or web designers.

For plain-php:

  1. The speed of pure PHP cannot be matched by any template engine built atop it.
  2. The full power of PHP is available to the output, and not just an interpreted or filtered portion.

I prefer PHP itself if at all possible. And most folks don't want to hack your software by making a custom theme, so it's easy to take a cursory read and investigate its security. That said, I am the "between guy" who does both templating and programming, and even some graphic arts; my skillset differs from a strict programmer and a strict artist/designer.