A Complete List of PHP Template Engines?

Conducting a small experiment. Been wondering “Just how many template engines does PHP have?”. My guess is there’s probably at least 50 Open Source template engines out there but was hoping for a more precise number. The reason why is get a feel for how many times we’ve re-invented this wheel.

So if I can beg a momemt of time, please add any template engines you know of to this list. They don’t have to be stand alone projects - phpBB for example has it’s own template engine so that counts as one. The main thing is identifying unique template engines.

Here’s the first few off the top of my head;

  1. PHP (yep PHP itself is a template engine)
  2. Smarty
  3. XSLT - technically XSLT is also a template engine
  4. PEAR::HTML_Template_Flexy
  5. PEAR::HTML_Template_IT
  6. PEAR::HTML_Template_PHPLIB
  7. PEAR::HTML_Template_Sigma
  8. PEAR::HTML_Template_Xipe
  9. patTemplate
  10. PHPTAL (port of Zope templates)
  11. PHP Savant - reclaiming PHP
  12. SimpleT - also reclaiming PHP
  13. YATS - Yet Another PHP Templating System
  14. phpBB template engine
  15. Fast Template
  16. Tiny But Strong
  17. YAPTER (yet another yet another?)
  18. Simple Turtle Template
  19. MiniTemplator
  20. TagTemplate

Wow - that’s already 20…

  1. http://www.ultratemplate.com/main.php

Not a bad project as it stands at the moment although for more features there needs to be more development; although it’d do it’s job if all you need is basic non complex functionality ?

Umm… IMO No. 17 looks like a solid Template Engine to use for general use no ? Just my thoughts though folks…

This will be fun.

Standalone:
22. Template Power
23. Virtual Template (French)
24. vLibTemplate
25. XTemplate
26. Richard Hayes Template class
27. Bugi Template (site is down? [URL=http://www.hotscripts.com/Detailed/14787.html]hotscripts entry)
28. bTemplate
29. Phemplate
30. Templeet
31. htmltmpl

  1. PHPLib
  1. PHPLib

Think I have to omit that one as it’s now PEAR::HTML_Template_PHPLib unless I’m mistaken. Also the project formerly known as Simple Template (or something like that is now known as PEAR::HTML_Template_Xipe

Couple more…

  1. eZ Publish 2.x Templates
  2. eZ Publish 3.x Templates - very different to 2.x

how about the PHP XSLT extension?
(or the transform capability from libXML2 in the upcoming version of the domdoc extension)

IMO, everything else is a waste of time.

btw. hello everyone. I’ve just dicovered sitepoint (from phpPatterns.com and I’ve been reading posts since midnight (now 2:15am :-))
some good meaty discussions here - my kinda place :smiley:

how about the PHP XSLT extension?

Up there at #3 - whether DOM might also be called a template engine is another question.

Some more from the PHP Resource Index

  1. TemplatePower
  2. Muze Template
  3. ETS - Easy Template System
  4. AvantTemplate
  5. Logic Template - not sure about this one - seems to be about turning PHP into an intepreter
  6. varpage (formerly known as ShellPage)

Welcome to SitePoint Tezza - You’ll find this forum will be a life saver at times :smiley: I know it has helped me many a time.

HarryF - DOM ? Proberly would be better to describe this as a form of templating yes ? Your article on DOM Widget’s for example would be a good place to begin.

Template-X is my template engine… I don’t have a dedicated page for it.

http://demo.deluxeportal.com/

You can look at it in the Admin Panel. (It’s since been updated for Beta 4, but it’s still similar)

Welcome as well Tezza - sorry - was mid train of thought. :wink:

HarryF - DOM ? Proberly would be better to describe this as a form of templating yes ? Your article on DOM Widget’s for example would be a good place to begin.

Now PHP-DOM has support for HTML why not?

  1. PHP-DOM extension (HTML support)

Does phpHTMLLib count, or does it fall under the DOM “exemption”?

Template-X is my template engine

Good enough for me :slight_smile:

  1. Template-X

Does phpHTMLLib count, or does it fall under the DOM “exemption”?

For me that falls under using PHP itself as a template engine (right now). Of course the author could invent a simple template syntax to eliminate the use of PHP but describes the API (which might be nice for designers)

I’m not so sure. it’s a good question. “Template” implies literal content around which dynamic content can be inserted. but what I tend to do is have a "base"class for my application which uses DOM::append_child and DOM::set_attribute methods to set up a “standard content envelope” for the application (before any transformation happens). So I guess I’m incorporating template functionality when I "initialise"a page in my app.

It’s not a templating system as such though. As in, it’s no a system for implementing templates.

XSLT most definately can be thought of as one though. You literally cannot compile an XSLT template against any XML without using the TEMPLATE directive - even though it is possible to declare an XSLT script without a single literal.

I’m not so sure. it’s a good question. “Template” implies literal content around which dynamic content can be inserted. but what I tend to do is have a "base"class for my application which uses DOM::append_child and DOM::set_attribute methods to set up a “standard content envelope” for the application (before any transformation happens). So I guess I’m incorporating template functionality when I "initialise"a page in my app.

Interesting. Like the definition.

My attempt at this is described here although DOM has to get alot more stable (and have a settled API) before I start using something like that in anger.


<h1>Powered by <phptag id="PHP" /> and <phptag id="MySQL" /></h1>

The markers are the <phptag/> elements which, via DOM, I manipulate in memory. It might be better done something like this though;


<h1>Powered by <a id="PHP" /> and <a id="MySQL" /></h1>

Also it’s probably a bad idea to perform the transformation in memory per page request. Better to parse the “template” with DOM then “compile” into a PHP script containing literal HTML plus PHP code. Something like;


<h1>Powered by <?php
$PHP = & new Tag('a',$dataSource);
echo $php->render();
?> and <?php
$MySQL = & new Tag('a',$dataSource);
$MySQL->render();
?></h1>

Selkirk’s been enlightening me: the Template View - Martin Fowler, in Patterns for Enterprise Application Architecture, describes it as;

Template View: renders information into HTML by embedding markers in an HTML page

i really like phptal, because it’s not one of those {} engines and it has nice wrappers for using xour own i18n and cache classes…

[Off Topic]

Looking over the manual at www.php.net on the DOM I noticed that there are a few functions for XSL stylesheets ?

Umm… In the past I’ve used the Sablotron extension and a class and it worked well enough though I found very few Sablotron web hosts and there is the question of benchmarking.

Now I am pondering on the idea that since nearly all web hosts have the DOMXML extension by default has anyone managed to use XSL-T with the DOM extension to the point of production level ?

It’d be an interesting concept to use XSL via the DOM for templating as I see it maybe…

Any thoughts on this folks ?

Sablotron and Expat are going away in PHP5, and the library that does DOM XML now will cover SAX and XSLT parsing. You shlould read Harry’s PHP article.

Some more…

  1. KTemplate (former Apolda Template)
  2. EZ Template
  3. 4Arrow Template Compiler
  4. DTE
  5. Enzyme Template (part of a mini framework)
  6. dutchtpl
  7. Xaraya - implements it’s own template engine
  8. Bleetz
  9. ASAPlate
  10. ecTemplate
  11. Freetemplate
  12. FT
  13. ModelIxe - site’s down right now but this one is interesting - it’s the guy that’s developing phpEdit and the Freshmeat [url=http://freshmeat.net/projects/modelixe/?topic_id=92%2C96]description makes it sound a little ASP.NET like.

Phew - that’s over 50. Need a break.