Brief introduction to Smarty3. These days I saw smarty3alpha taking the lead, so I took the time to do a visit investigation. The following text basically comes from readme: basic file structure index. phplibsSmarty. class
These days I saw smarty 3 alpha taking the lead, so I took the time to do a visit investigation. The following text basically comes from its readme:
Basic File structure
Index. php
/Libs/
Smarty. class. php # Master File
/Libs/sysplugins/# internal plugin
Internal .*
/Plugins/# external plugin, which can be expanded freely
Function. mailto. php
Modifier. escape. php
/Templates/# template, which can be a pure php or traditional smarty Template
Index. tpl
Index_view.php: a classic smarty call
Code snippet:
Require (Smarty. class. php );
$ Smarty = newSmarty;
$ Smarty-> assign (foo, bar );
$ Smarty-> display (index. tpl );
It seems no different from the previous version.
SINGLETON
Does this make sense?
Code snippet:
$ Smarty = Smarty: instance ();
Template
The previous smarty template is equivalent to redefining a set of tag languages. Therefore, smarty3 provides a new template that directly supports php syntax.
But the problem arises. Do we still need to use a template?
An example of referencing a php template:
Code snippet:
$ Smarty-> display (php: mytemplate. tpl );
You can directly use the familiar syntax in the template:
If you use a php template, you must solve the security problem yourself. However, this is not a problem for mature teams.
In addition, the newly supported string-type templates feel fierce, and the path from the template is also drifting away:
Code snippet:
$ Smarty-> display (string: This is my template, {$ foo }!);
Smarty3 links
Smarty 3 Alpha with SVN -- selecting the svn service provided by googlecode is quite cost-effective
Smarty 3 developer contact list
Listing 3 alpha took the lead, so it took time to do a visit investigation. The following text basically comes from its readme: basic file structure index. php/libs/Smarty. class...