I saw smarty 3 alpha popping up these days, so I took the time to conduct a survey. The following text basically comes from its readme: Basic file file structure SINGLETON Code snippet: But the question arises, do we still need to use templates? An example of quoting a php type template: Code snippet: If you use PHP templates, security issues need to be solved by yourself. But this is not a problem for mature teams. In addition, the new support for string type templates feels more vigorous, and the road away from templates is also getting further and further away: Code snippet:
index.php
/libs/
Smarty.class.php #Main file
/libs/sysplugins/ #Internal plugin
internal.*
/plugins/ #External plugin, can be freely expanded
function.mailto.php
modifier.escape.php
/templates/ #Template, can be pure PHP or traditional smarty template
index.tpl
A classic smarty call in index_view.php
Code snippet:
require(Smarty.class.php);
$smarty=newSmarty;
$smarty->assign(foo,bar );
$smarty->display(index.tpl);
There seems to be no difference from the previous version
Does this make sense?
$smarty= Smarty::instance();
Template
The previous smarty template is equivalent to redefining a set of tag languages, then smarty3 provides a new template Form, directly supports PHP syntax templates.
$smarty->display(php:mytemplate.tpl);
You can use familiar syntax directly in the template: =$foo?> =$bar ?>
$smarty->display(string:This is my template, {$foo}!);
Related links for smarty3
Smarty 3 Alpha with SVN--select googlecode to provide The svn service is quite economical
smarty 3 developer mailing group