PHP and MySQL programming (version 3rd) -- 19.2 introduction to Smarty

Source: Internet
Author: User

19.2 introduction to Smarty

Smarty (http://smarty.php.net/) is PHP's "Half official" templated engine, from its home page location can be seen. The authors of Smarty are Andrei Zmievski and Monte Orte. It was released under GNU wide Universal Public License (LGPL, http://www.gnu.org/copyleft/lesser.html) and may be the most popular and powerful PHP templated engine.

Smarty also provides many powerful functions, which will be discussed in this chapter and summarized as follows.

Q powerful presentation logic. Smarty provides an appropriate structure for conditional computing and iterative data processing. Although it is actually a language, the syntax is very simple, and designers can quickly learn it without the need to prepare programming knowledge.

Q template compilation. To reduce the overhead, Smarty converts the template to a comparable PHP script by default, making subsequent calls faster. Smarty is also very intelligent and can be re-compiled after the content changes.

Q cache. Smarty also provides the optional features of cache templates. Different from compiling, caching not only generates cached content, but also prevents execution of individual logic. For example, you can specify the survival time of cached documents, for example, 5 minutes. During this period, you can ignore database queries related to this template.

Q height configurable and scalable. Smarty's object-oriented architecture allows you to modify and extend its default behavior. In addition, configurability is a design goal from the very beginning, providing users with great flexibility to customize Smarty behavior through built-in methods and attributes.

Q security. Smarty provides many security features to avoid the intentional or unintentional destruction of server and application data by designers.

Remember, all popular templated solutions follow the same set of core implementation principles. Just like programming languages, learning one language makes it easier to master other languages. Therefore, you can continue to read it even if you do not use Smarty. The concepts introduced in this chapter can definitely be applied to any other similar solutions. In addition, this chapter will not fully copy the content of the Smarty manual, but only focus on the key features of Smarty, so that you have a preliminary understanding of this solution, and always emphasize the general concept of templated.

Related Article

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.