Template Lite, a Smarty compatible template engine, releases version 1.20

p. I’m not lazy. I just feel that it’s important to expend as little effort as necessary to accomplish any given goal. Less **is** more, smaller **is** better, and lite **is** good. With that in mind, let’s talk about “Template Lite”:http://templatelite.sourceforge.net/. Another template engine for PHP. (All together now, roll your eyes and get it over with.)

p. Template Lite released “version 1.20″:http://sourceforge.net/project/showfiles.php?group_id=163694 yesterday. (wait, that can’t be right…there’s no BETA…**where is the beta?!?**) It is billed as a drop in replacement for the venerable “Smarty Template Engine”:http://smarty.php.net/. It’s selling point is faster execution and a smaller memory footprint at the expense of some of the options. Template Lite started life as a project named Smarty Lite but for reasons too boring to go into here, the original code base was abandoned.

p. “Mark Dickenson”:http://panamajack.aatraders.com/readblog/dac91775fd510be6a394e6030b0aebb2c50e85d3dd134510 picked up the project, renamed it and is now the maintainer of the current code base. He has this to say about his project.

bq. Template Lite can compile and display any template file that works with the Smarty engine except for those that use the SECTION function. Template Lite uses the much more familiar FOR function. I will probably add support for the SECTION function in a later release to maintain compatibility. I would recommend everyone use the FOR function instead because it is many, MANY times faster in execution while offering the same functionality. The SECTION function in Smarty was something that never should have been created by the authors in my opinion. It is just plain slow and overly convoluted for what it does.

p. Ah, a man after my own heart. No sugar coating or side-stepping the issues. He wields his opinion like a sledgehammer. [Note to "Sir Berners-Lee":http://en.wikipedia.org/wiki/Tim_Berners-Lee: the Semantic web needs a HUMBLE tag...not that I personally would ever use it.]

p. The comments over at “Maugrim The Reaper’s Blog”:http://blog.quantum-star.com/index.php?/archives/182-Template-Lite…here-we-go-again….html seem to indicate that there still may be some bugs to bludgeon to death with Marks opinion.

p. The “Smarty Template Engine”:http://smarty.php.net/ is a great piece of code but it may be overkill for some projects. If you need lighter, faster and simpler, and don’t want to expend the energy yourself to find a replacement, take a look at “Template Lite”:http://templatelite.sourceforge.net/

=C=

Published: March 29th, 2006 at 8:36
Categories: News
Tags: , , , , ,

3 comments to “Template Lite, a Smarty compatible template engine, releases version 1.20”

This site, the Zend Developer Zone, uses Smarty although we might give the lite version a try, we have been very happy with Smarty. First we will convert to the Zend Framework’s View component and make that our next step.

I gave Template Lite a quick look and I must say I’m impressed with the file-size differences:
236 kB for Template Lite compared to 1.6 MB for Smarty. (unpacked)
While browsing through the source I saw some things I didn’t like though…
The output of a sample radio button:

Smarty:
<input type="radio" name="radioName" value="radioValue" checked="checked" />

Tempate Lite:
<input TYPE="RADIO" NAME="radioName" VALUE="radioValue" CHECKED />

Guess which one won’t pass as valid XHTML…

There are a lot of other things why I prefer Smarty over Template Lite, but I don’t want to make this sound like a big bash.
My conclusion is that this lib is nice for people just starting with template engines and who just want to play around a bit with the templating idea, but the XHTML/control obsessed TE user should stick to Smarty IMHO.

I will admit there were still a number of incompatibilities with the earlier versions.

Please check the latest release (1.60.1). This version comes closer to being a drop in replacement even though there are some things still not supported.