1. Introduction
Smarty is one of the most famous PHP template engines in the industry, which is a PHP template engine written using PHP. It separates the logic code from the external content, provides an easy-to-manage and useful way to separate the PHP code that was originally mixed with HTML code. Simply speaking, the purpose is to make PHP programmer with the front-end separation, so that the PHP programmer to change the logic of the program does not affect the front-end page design, the front-end re-modify the page does not affect the program logic, which in the multi-person cooperation project is particularly important.
2. What are the advantages of smarty?
A, Speed: The program written in Smarty can achieve maximum speed improvement, which is relative to other template engine technology.
B, compiled: The program written in Smarty is compiled into a non-template PHP file at run time, this file is a mixture of PHP and HTML, the next time you access the template, the Web request directly into this file, Instead of recompiling the template (in case the source program has not changed)
C, caching technology: Smarty The use of a cache technology, it can be the final user to see the HTML file cached into a static HTML page, when set Smarty the Cache property is true, The user's Web request is converted directly to this static HTML file during the Cachetime period set by Smarty, which is equivalent to calling a static HTML file.
D, plug-in technology: Smarty can customize the plugin. Plugins are actually some of the custom functions.
E, if/elseif/else/endif can be used in templates. The template file can be easily reformatted by using a judgment statement.
3, however, the use of smarty in the following circumstances should be noted
A. Content that needs to be updated in real time. For example, like a stock display, it needs to update the data frequently, and this type of program uses Smarty to slow down the processing of the template.
b, small projects. Small project because the project is simple and the artist and programmer are one-man project, the use of Smarty will lose some of the advantages of rapid development of PHP.
(PS: But for the entire project specification, please try to use the template engine.) In fact, the development speed will be faster, the above is not used in the habit of template engine developers encounter problems)
http://www.bkjia.com/PHPjc/775001.html www.bkjia.com true http://www.bkjia.com/PHPjc/775001.html techarticle 1. Introduction Smarty is one of the most famous PHP template engines in the industry, which is a PHP template engine written in PHP. It separates the logic code from the external content and provides a ...