A brief introduction to Smarty3_PHP tutorial

WBOY
Release: 2016-07-13 17:37:30
Original
833 people have browsed it

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

SINGLETON
Does this make sense?

Code snippet:
$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.

But the question arises, do we still need to use templates?

An example of quoting a php type template:

Code snippet:
$smarty->display(php:mytemplate.tpl);
You can use familiar syntax directly in the template:

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486573.htmlTechArticleI 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 index.php /libs/ Smarty.class...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template