So I'm out ego-surfing for reviews of my Savant template system, and I find this from Norbert Mocsnik; he says he tried other template engines such as Smarty and Flexy, and then...

Conclusion: whatever template engine I've tried (it probably helped me a lot in developing applications faster BUT) all the time, I mean every time there were things that I couldn't do with them.

So I switched back to Savant. Simple. Nothing to learn. Nothing that you can't do. Pure PHP. I recommend it for y'all. Give it a try. (it has drawbacks also.. if you want your users to be able to edit the templates, it's probably not a good idea to let them enter arbitrary php function calls.. there may be other things.. feel free to comment).

I love good press. :-)

Norbert makes a great point about the Savant 1.x series: all templates must be written in pure PHP, which sucks if you want to give untrusted users access to your template code.

Solution: try Savant2. :-) Savant2 has optional support for any custom compiler object you wish to write; just pass it into the Savant2 object using setCompiler() and Savant2 will use that object to compile the template source into PHP for you. (Of course, you still have to write the compiler yourself, which has benefits and drawbacks of its own -- but one major benefit will be that you can replace one compiler with another and still use the same template system API.)

While I'm shamelessly plugging my own work ;-) I'll mention that Savant2 is no longer dependent on PEAR. It has a customizable error system that can use PEAR_Error, PEAR_ErrorStack, or any other error handling system you want to plug into it. Savant2 even has suppoort for streams as template sources.

The only bad thing about Savant 2.x is that the documentation is not complete. You can see the work-in-progress docs here.

UPDATE (2004-11-18): Documentation has been complete for several weeks now; you can view it at the Savant web site.

Are you stuck with a legacy PHP application? You should buy my book because it gives you a step-by-step guide to improving you codebase, all while keeping it running the whole time.