After a long time, I finally want to ask, what is the use of Smarty?

Source: Internet
Author: User
After a long time, I finally want to ask, what is the use of Smarty? & Nbsp; When I went to Baidu, we all said that it provides separation of logic and external content, which is conducive to better cooperation between programmers and art engineers. Cache cloud... & Nbsp; I have been using smarty for many projects. & Nbsp; & n has been holding on for a long time. I finally want to ask, what is the use of Smarty?
When I went to Baidu, we all said that it provides a separation of logic and external content, which is conducive to better cooperation between programmers and artists. Cache cloud...

Smarty is also used in many projects I have been using.

The most common smarty syntax I use is foreach and if judgment. sometimes I use the functions in it, because many projects are now ready-made.

Frameworks, whether popular on the Internet or encapsulated by themselves, are all in mvc mode without exception. Therefore, even if there is no smarty template, there will be no logic code on the page.

There are only some foreach, if, or some basic functions on the surface, but the writing method is different. The smarty tag can be defined by yourself, for example, {}, while the php tag ,

In mvc thinking, code writing is still clean even if there is no smarty page, and php functions can be used flexibly. what's wrong?

If the cache is provided, I do not have much research on smarty. I don't know if it is said that the pages in it are purely static. if so, I can still understand why it is used.

It, but if not, I would be even more puzzled to share:
------ Solution --------------------
Smarty is the template engine
The role of the template engine in php is to separate php code from html code.
That's all.

The cache is another mechanism, which is a subsidiary function in smarty. When smarty was born, there was basically no framework available for use.

Smarty introduces process control in the template and forms a language for interpreting execution templates by php.
I personally think that it is why I am not optimistic.
------ Solution --------------------
I don't like smarty.
Do not use smarty for personal products.
The syntax of the template is basically replaced with the php code to run, and another step is taken.

Why do some open-source products use similar products or practices like smarty?
I think one important reason is to consider security.
Only allow you to use the methods designed by the programmer, so that the artist and template designer will not be confused.
Without a rmdir, it cannot be pulled.

There is also the cache mentioned by my friend above .. The cache of smarty is not a cache.
Only the php code is cached, and the replacement is avoided again.

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.