views:

456

answers:

3

What are some PHP template engines that offer a simple, short syntax? What we're looking for is:

  1. Conditionals (if/else)
  2. Foreach loops
  3. Variable replacements
  4. Able to create custom tags (i.e., for URL generators)

We need it to be secure because the applications are being run on our own servers, but we still want people to be able to edit the way things look. This is why we're disregarding the pure PHP-based systems.

I love how Django's engine works, but the only PHP implementation I've seen (Calypso) is not very mature and doesn't look like it's going anywhere.

A newish project called Dwoo looks interesting but it's taking a bit of work to get it working the way we need it to. Basically we have to get templates from a database and then cache the "compiled" version to memcached, but Dwoo doesn't offer a very simple way to switch template providers/caching mechanisms. It's tied to the filesystem and filesystem-like behaviors. It is possible, but we're looking for other options.

We may just end up using Smarty. But I'm not sure of the future of this project, it seems a bit dead.

+4  A: 

I'm big fan of PHPTAL. I like that the template syntax is valid XML/XHTML. And since it's DTD driven, you can even integrate the language into many editors.

Peter Bailey
A: 

Makrell is an interesting approach to template engines.

troelskn
+1  A: 

Check out Top 25 PHP template engines. Oh, and Smarty.net recently announced a new Smarty Engine. So it's alive and kicking.

Bob Fanger
Unfortunately, that site doesn't provide the article anymore.
Spoike
"fixed" the link
Bob Fanger