php template smarty

高洛峰
Release: 2023-03-02 20:08:02
Original
950 people have browsed it

PHP’s template technology should be mentioned often. For example, the famous phplib fasttemplate basically implements the MVC model, which is indispensable. It seems that not many people use these two templates now because there are other templates. Class smarty, the main difference between smarty and phplib template classes is that smarty has a caching function, so there is no need to recompile the template every time the program is opened.

The following is my opinion on smarty after using it.

smarty is not the best because its compiled templates are too bloated. You can open the smarty compiled template page, which is full of objects and very complex. PHP is very slow in processing object variables. , and the compiled template does not need to be seen by programmers, why bother making it so complicated, which will affect the speed.

In addition, if you want to use smarty, you need to be familiar with some of its specialized syntax, which is like learning a new language (although it is not very complicated, it is still very troublesome).

Finally, smarty is very dead, and it is almost impossible to define the template tags you want.

The following introduces a template technology that feels good. The template function of discuz!

discuz!’s template function is to directly replace the tags in the template with PHP syntax. The final result of the program execution is actually a program that mixes PHP and HTML. This way the program is the fastest. No one will object to this statement.

discuz!’s template function is very concise, with only a few dozen lines. Compared with smarty, it is much more concise. With such a concise code, if you want to add new functions or tags, it is very simple. You can also implement MVC , and the speed is definitely faster than smarty. Achieving the perfect combination of flexibility and high speed.



Related labels:
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