The Savant Template System for PHP

The simple, elegant, and powerful alternative to Smarty.

  Savant2 (2.4.3)   Documentation   Contributed Classes   Other Information  

Savant Versions:

Savant2

Savant3


Please help support Savant; you can donate, or click on a sponsor.

Amazon Honor System Click Here to Pay Learn More

Why Use Savant?

  • You don't need to learn a new language or markup to create a template. The template language is PHP, and the template file is a regular PHP file (use the suffix .tpl.php to indicate it is template logic and not business logic).
  • You don't have to worry about separate directories (or permissions on those directories) for compiled template sources, because Savant is not a compiling engine (the template scripts are already written in PHP).
  • The Savant source code is easy to read, understand, and extend, because it is exceptionally well-commented (the code alone is 8K, with comments it's 24K).
  • The object-oriented plugin system for Savant is easy to use, understand, and extend.
  • Because your template script is a regular PHP script, you can sprinkle it with comments and use phpDocumentor to document it.

Why Use Savant When It's Just PHP?

Because you still want to separate your business logic from your display logic.

Savant provides an easy interface to define your business-logic/display-logic boundaries, and at the same time provides convenience methods for generating display (e.g, building a series of HTML <option>s from a single command) and output filters to apply transformation to pages before delivery.

Savant2:WhySavant (pmjones)
Wed Sep 8 13:47:40 2004
[ Links | Source | History | RSS ]

This site powered by YaWiki 0.22 beta.

Copyright © 2003-2010, Paul M. Jones.


pmjones [AT] ciaweb [DOT] net
2004-09-03 09:40:56 (510)
Hi, Smartinec -- Savant is not a template "engine", it is a template "system." Maybe the differences are semantic. Your code listing is perfectly valid, if you know exactly where the template is and you don't want to filter the output. The strength of Savant lies not a way to convert special markup to PHP code, becuase Savant uses PHP as its markup language. Instead, Savant provides a plugin framework, output filtering, and a way to automaticaly pull templates from multiple directories (which allows easy theming of applications). Savant2 is even better, in that it allows custom compilers and custom error handling; I just need to document the silly thing. Hope this helps. :-) -- pmj
pmjones [AT] ciaweb [DOT] net
2004-09-03 09:34:58 (509)
Hi, onietzschedancanteestavivo; no, it's not from SCO. Very funny. ;-)
smartinec [AT] gmail [DOT] com
2004-09-03 09:31:52 (508)
I really do not see the purpose of Savant. It claims to be a template engine, but doesn't actually have any features. How is it any better then the code below? <?php $title = 'Template Engine'; $name = 'John'; include('my_template.tpl.php'); ?>
onietzschedancanteestavivo [AT] uol [DOT] com [DOT] br
2004-07-14 01:03:29 (424)
This sounds good! ...Is it SCO's code?
matt [AT] megameta [DOT] net
2004-06-03 19:58:38 (333)
I love it! It's almost like parody code, just to show to the template engine addicts that really all they need is PHP and the presense of mind to not put business logic in their template files.
yoda [AT] mcmac [DOT] com
2004-05-08 22:22:19 (224)
I have no use it already but it sounds like a dream comes true! I have always thought that it's not important to separate PHP from HTML, what really matters is to put appart Logic from presentation. That's the path...

New comments are disabled.