Beyond The Template Engine

[ via Eric Snowden ] Brian Lozier has a great Sitepoint article on PHP template engines.

His main point is that a template engine should dissociate presentation from logic, not keep PHP code out of HTML.

He gives us a compact, caching template class using those principles. His templates use PHP’s echo () and the alternate for-each syntax, so you don’t worry about learning a new language.

I don’t like the short-open tag syntax he uses, since I can’t treat the template files as XML with processing instructions, but the templates will work with <?php echo $foo; ?> instead of <?=$foo ?>.

Related posts:

  1. Savant3: Simple Templating for PHP5
  2. Template Languages in XSLT
  3. Freemarker HTML Templates for Java Servlets
  4. Generic Programming and the Standard Template Library
  5. Genpage Perl HTML Template Pre-Processor

More like this: .