PHP template Smarty

Source: Internet
Author: User
PHP template technology should be often mentioned, like the more famous Phplib Fasttemplate, have basically implemented the MVC pattern, the work is not abrasive, now with the 2 template is not much, because there is another template class Smarty, Smarty and Phplib The main difference between these template classes is that Smarty adds a cache feature that does not have to recompile the template every time you open the program.

Below I have used the smarty, the view of it.

Smarty did not do the best, because its compiled template is too bloated, you can open the Smarty compiled template page, inside are some objects, and very complex, PHP on the object variable processing is very slow, and the compiled template is not required to see the programmer, why to make so complicated, can affect speed.

In addition, to use smarty, you also need to familiarize yourself with some of its specialized grammar, like learning a new language (though not very complex, but also very troublesome).

Finally, Smarty is very dead and can hardly define the template tag that he wants.

Here's a template technique that feels good. The discuz! template function.

The template function of the discuz! is to replace the label in the template directly with the PHP syntax, and the result of the program execution is actually PHP and HTML mixed program, so the program speed is the fastest, no one will oppose this argument.

discuz! template function is very concise, only a short dozens of lines, compared to smarty, to be concise too much, so concise code, if you want to add new features or tags is very simple, the same implementation of MVC, and speed than smarty absolutely faster. The perfect combination of flexibility and speed is achieved.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.