/    Sign up×
Community /Pin to ProfileBookmark

PHPSavant vs. Smarty

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:

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

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

[CODE]
<ul>
{foreach from=$list item=”line”}
<li>{$line.text|escape}</li>
{/foreach}
</ul>
[/CODE]

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):

[CODE]
<ul>
{TPL:LINE}
</ul>
[/CODE]

line template (mylist_line.tpl.php):

[CODE]
<li>
{VAL:TEXT}
</li>
[/CODE]

code being executed (process_template.php):

[CODE]
<?php
// some PHP script (containing [COLOR=Red]NO[/COLOR] HTML tags), which is loading and processing template files, according to arguments supplied

?>
[/CODE]

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?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsNov 09.2005 — Smarty-light. But your thing about "whole new language" kinda kills any advanced templating ideas you might have.
Copy linkTweet thisAlerts:
@MareqauthorNov 09.2005 — Smarty-light[/QUOTE]
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...
×

Success!

Help @Mareq spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...