I saw the emergence of smarty 3 alpha these days, so I took the time to do a visit and survey. The following text basically comes from its readme:
Basic file file structure
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
Index_view.php is a classic smarty calling 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
SINGLETON
Does this make sense?
Code snippet:
$smarty= Smarty::instance();
The smarty template before the template is equivalent to redefining a set of tag languages, so smarty3 provides a new template form that directly supports PHP syntax templates.
But the question arises, do we still need to use templates?
An example of quoting PHP type templates:
code snippet:
$smarty->display('php:mytemplate.tpl');
Familiar syntax can be used directly in the template: <?=$foo?> <?=$bar?>
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 path away from templates is also getting further and further away:
Code snippet:
$smarty->display('string:This is my template, {$foo}!');
Related links of smarty3
Smarty 3 Alpha with SVN--It is quite economical to choose the svn service provided by googlecode
smarty 3 developer mailing group