Savant – Simple PHP Templating Engine
Using templates is especially useful in web application development. It allows developers to create custom layouts that will display data any way you want. It keeps your web application organized by separating the logic and programming from the design and interface. There are many template engines out there, but perhaps none like Savant.
Savant is a simple, elegant, templating engine for PHP. It is an object orientated system that harnesses PHP’s built-in templating features to allow for an extremely lightweight template engine while maintaining robustness.
The major contrast between Savant and other templating engines such as Smarty is how it runs. It does not need to compile your php code first in order to build the page. It sees PHP as a template builder already. (This is the same logic that powers Wordpress templates.) What this allows for is the fastest script execution time.
A downside to Savant is its implementation. Since it does not compile first, you will be using PHP tags placed in your template to display data. For example, Smarty’s syntax would allow for “{$variable}” while Savant would allow only “<?php echo $this->variable ?>”. Although, if you have PHP shorthand enabled (short_open_tag=On in the ini file) you can simply use “<?= $this->variable ?>”.
Savant’s syntax is clean, incredibly simple to understand and explained thoroughly through the Quickstart guide and API documentation, and very easy to install.





9 Responses to Savant – Simple PHP Templating Engine
I thought savant got obsolete once the frameworks came into play. While savant has a controller – view separation, frameworks have MVC or another pattern to separate code.
david
1/11/2009 at 2:08 pm
Short tags will not be in PHP 6.
EllisGL
1/11/2009 at 9:55 pm
I simply don’t see any situation when I would benefit from this convoluted template system. I’d have to agree with david that this “app”(app? really?) is obsolete.
This is no attempt to self-promote, but a while back I released very simple and free – as in free bear – open source framework that is far more useful than this called Skeleton CMS (you can find it on opensourcecms.com or at greg-j.com) that I would encourage anyone to use over this.
@EllisGL,
PHP 6 does not drop support for short tags. It does however drop support for ASP style tags.
Greg-J
1/12/2009 at 6:05 am
Short tags *will* be in PHP 6. Not ASP style tags.
ng
1/12/2009 at 7:25 am
variable ?>
works if you have short tags enabled or not.
marcosdsanchez
1/12/2009 at 8:16 am
“variable ? >”
works if you have short tags enabled or not. (It was escaped the first time I posted it)
marcosdsanchez
1/12/2009 at 8:18 am
are you sure?
xrado
1/12/2009 at 9:03 am
I wouldn’t consider it obsolete. While I don’t have any good examples at the moment there may be times when I don’t want to use a full blown framework, but a simple templating engine like Savant.
Randy
1/12/2009 at 9:24 am
Templating is certainly not obsolete. However, I don’t see much advantage to this over Smarty. I use Smarty for my site as well as my day time job. It is great. One of the greatest uses is to avoid escaping in and out of PHP all the time. Savant doesn’t seem to remove that problem.
For everyone suggesting that MVC frameworks make template engines obsolote: I would hazard a guess there are undoubtedly more non-framework users than framework users. For all of us doing PHP apps from scratch, templating is a lifesaver.
AppBeacon
1/13/2009 at 1:06 am