Which PHP templates can separate PHP code from HTML code. What are their advantages and disadvantages? ------ Solution ------------------ Smarty1. speed: programs written in Smarty can achieve maximum speed improvement, which is relative to other template engine technologies. & Nbsp; 2. compiler type: a program written in Smarty must be compiled into a PHP file with non-template technology during runtime.
Which templates can separate PHP code from HTML code. What are their advantages and disadvantages?
------ Solution --------------------
Smarty
1. speed: programs written with Smarty can achieve the maximum speed improvement, which is relative to other template engine technologies.
2. compilation type: a program written in Smarty must be compiled into a non-template PHP file during runtime. this file adopts a mix of PHP and HTML, during the next Template access, the WEB request is directly converted to this file, instead of re-compiling the template (without modifying the source program)
3. cache technology: a cache technology used by Smarty to cache the HTML file that the user sees as a static HTML page. when the cache attribute of Smarty is set to true, during the cachetime period set by Smarty, user WEB requests are directly converted to this static HTML file, which is equivalent to calling a static HTML file.
4. plug-in technology: Smarty can customize plug-ins. Plug-ins are actually some custom functions.
5. You can use if/elseif/else/endif in the template. Using judgment statements in the template file can easily rearrange the template format.
Not suitable for Smarty
1. content to be updated in real time. For example, for a stock display, it often needs to update the data, resulting in frequent re-compilation of the template, so the use of Smarty for this type of program slows down the processing speed of the template.
2. small projects. Small projects because the project is simple and the artist and the programmer have one-person project, using Smarty will lose the advantage of rapid PHP development to a certain extent