0 reply content: it is indeed missing. I think there are many reasons:
- Smarty is used to spell pages, but now the pages are complex and asynchronously loaded. Many logics are implemented by js, resulting in less work for php to directly spell pages themselves.
- The logic of smarty itself is complex, and there are many cache layers, but the actual website does not use that many functions, so there is no need for smarty to reduce some overhead.
- The functions of smarty are not complex. Many open-source cms products integrate their own R & D alternatives, and there are not many integrated smarty products. Foreign open-source frameworks will also mention how to integrate, but the domestic influence of these products is far inferior to the secondary development of local ready-made open-source projects.
- By default, smarty uses local file caching. Currently, more and more deployment environments are not allowed to write files locally (such as some cloud environments), and must be adjusted before use.
- Php itself is not complex, and it is not complex to the extent that front-end engineers can't learn, so you don't have to go back and learn the smarty syntax to interact with the php layer.
In the past few years, the interview engineer must ask smarty, because it is a field that engineers who do not have a textbook but have a slight sense of smell in the industry will pay attention to. However, no one has mentioned it in their resumes, you feel right.
Because PHP itself is the best
TemplateI didn't graduate when the language Smarty was popular, and I felt I couldn't understand it at the time. PHP already has an embedded syntax, like ... This is not difficult to learn than Smarty at all, and it is more flexible, not parse, and the readability is high. As for the frontend and backend separation advocated by Smarty, isn't it just a single layer of view? An include statement in PHP can solve the problem. So I thought there was no significance for the Smarty.
But now it's better. People's understanding is back to common sense. In PHP. Use smarty to solve the problem of front-end and back-end separation. But in my opinion. It is better not to worry about it. Because PHP is used to modify the page. At the end of the day, the front-end will not change your things. Therefore, it is equivalent to adding a layer to the hardware. In addition, the local cache is generated. In fact, what I said at the beginning is that it has been generated. So this is not used. Actually. We complicate simple things. You can see that wordpress or CodeIgniter both use native templates. Because PHP itself is a template engine, it supports mixed nesting with html. So why do we have to use smarty. You have another process of parsing the Template into native PHP. A waste of time. You also need to write files. It is better to directly write native... I. Smarty itself is too heavyweight. Some of the built-in cache mechanisms are highly restrictive.
II. Ajax and other emerging technologies are introduced. Few pages were rendered at one time by the php server. Instead, it is handed over to the client for multiple rendering by js.
3. The rise of the mvc Framework, the built-in template engine is better than smarty. For example, a company's internal project of CI is still using smarty, and it is in ci ..