Click to See Complete Forum and Search --> : PHPSavant vs. Smarty


Mareq
11-08-2005, 09:03 AM
I am in need of web template engine and I am considering two options. PHPSavant and Smarty.

I am using PHP ver. 5 and PostgreSQL database. PHPSavant supports PHP5 only in beta2 version, so I am affraid of some serious bugs, but at the other hand, as far as I know, Smarty do not support PHP5 at all.

I do not want templates, where HTML and PHP are mixed up together like this:

<ul>
<?php
foreach($list as $line) {
echo '<li>'.$line['text'].'</li>';
}
?>
</ul>

or even worse, when template engine defines its own language:

<ul>
{foreach from=$list item="line"}
<li>{$line.text|escape}</li>
{/foreach}
</ul>

What I want are clean templates in template files and universal code to process them in the other file, like this:
base template (mylist.tpl.php):

<ul>
{TPL:LINE}
</ul>

line template (mylist_line.tpl.php):

<li>
{VAL:TEXT}
</li>

code being executed (process_template.php):

<?php
// some PHP script (containing NO HTML tags), which is loading and processing template files, according to arguments supplied
...
?>


Do anybody know PHPSavant and Smarty better than me (had used them) and can tell me which of these two is capable to meet my needs, please?

SpectreReturns
11-08-2005, 08:12 PM
Smarty-light. But your thing about "whole new language" kinda kills any advanced templating ideas you might have.

Mareq
11-08-2005, 08:19 PM
Smarty-light
What does it mean?


About "whole new language"... I do not think it kills any advanced templating ideas, I just divide whole thing into design and code parts. There is no need for new language. The same thing could be achieved using standard language, in some kind of "plugins", which process pure HTML templates...