Overview
The aim of this templating engine is to provide web application developers who want to separate the program code and the design of their web applications with a templating tool that can be used by cooperating webdesigners who have no programming skills.
The syntax of the templating language used by the engine is inspired by the well-known Perl module HTML::Template. Templates created for HTML::Template can be used with this engine.
The engine is currently available for PHP and works with both PHP4 and PHP5. The Python version I created a few years ago is no longer maintained, but you can still download it here and browse its old Sourceforge website here.
The primary aim of the templating engine is to keep things simple for the webdesigner who creates the templates. Therefore, neither Python nor PHP code is used in them. Instead, the templating engine provides its own simple templating language that supports basic programming constructs - loops, conditionals and the substitution of variables. These constructs look like HTML tags and integrate nicely with normal HTML code.
The secondary aim is for the module to provide good performance. Its code is highly optimized and the templates are precompiled and saved on disk in this precompiled form, so that it is not necessary to parse them again and again on every request.
The engine must also be reliable. It has been well tested over the last five years in a few large-scale installations and also comes with an extensive automated test-suite.
I am aware that other templating solutions for Python and PHP exist, but none of them is similar to HTML::Template. I like its enforcement of strict separation of code and HTML, and also the style and the syntax of its templating language and I think that it is cleaner and more maintainable than other solutions. Also, I needed to move some projects from Perl to PHP and so I wanted to reuse my old HTML::Template templates. That's why I created the templating engine in the first place.
In newer versions the engine has also an integrated support for gettext, which makes it convenient for easy development of multilingual web applications.
Download
htmltmpl-php-2.01.tar.gzAuthor and license
Copyright (c) 2007 Tomas Styblo <tripie@cpan.org>
You can use and redistribute the engine under the conditions of the GNU General Public License. The license can be found either at http://www.gnu.org/ or in the LICENSE file in the distribution package of the engine.
Credits
The syntax of the templates was inspired by the Perl templating module HTML::Template created by Sam Tregar <sam@tregar.com>. Htmltmpl was designed and implemented from scratch and is not based on the code of HTML::Template.
You should check out the documentation of HTML::Template. The templating language of htmltmpl is fully compatible with HTML::Template and the documentation of HTML::Template describes it much better than the still incomplete documentation of htmltmpl.