What is the role of the template tag in the template engine-ThinkPHP?

Source: Internet
Author: User
There are many built-in tags in TP, such as comparison, and loop. Using PHP for server-side development usually works with the front-end. I personally think these tags will complicate the readability of HTML, in addition, front-end engineers should not waste time on these labels ...... I thought about two points: to inherit, the previous one... there are many built-in tags in TP, such as comparison, and loop. Using PHP for server-side development usually works with the front-end. I personally think these tags will complicate the readability of HTML, in addition, front-end engineers should not waste time on these labels ......

I thought about two points:

  1. To inherit, I used CI to overwrite the load object in my previous project and used PHP to assemble HTML. In this regard, there will not be much difficult to do.

  2. If we talk about frontend and backend separation, I think web development itself is a job that requires a broad range of relevant knowledge and there must be a part of integration, after the template engine is used, the front-end still needs to write a lot of template variables (it is true that you just need to enter a few characters ......).

Finally, I think that the program should solve the problem and give priority to the performance. Therefore, we do not quite understand the original intention of template design. The source code of TP is not complete, and we do not know much about the performance of these built-in labels.

At the beginning, I used TP. Maybe I have a wrong understanding. Don't despise me ......

Reply content:

There are many built-in tags in TP, such as comparison, and loop. Using PHP for server-side development usually works with the front-end. I personally think these tags will complicate the readability of HTML, in addition, front-end engineers should not waste time on these labels ......

I thought about two points:

  1. To inherit, I used CI to overwrite the load object in my previous project and used PHP to assemble HTML. In this regard, there will not be much difficult to do.

  2. If we talk about frontend and backend separation, I think web development itself is a job that requires a broad range of relevant knowledge and there must be a part of integration, after the template engine is used, the front-end still needs to write a lot of template variables (it is true that you just need to enter a few characters ......).

Finally, I think that the program should solve the problem and give priority to the performance. Therefore, we do not quite understand the original intention of template design. The source code of TP is not complete, and we do not know much about the performance of these built-in labels.

At the beginning, I used TP. Maybe I have a wrong understanding. Don't despise me ......

Use the native PHP code. The final effect is the same as that of the template. The template will also be parsed into the native code. It seems that efficiency is slightly different.

I think that since you use the framework, it is better to use their templates to write code. After all, developers of each template have made various convenient settings after careful consideration. If you have to write native PHP, why should you use the framework? If you do not develop it according to the framework specifications, it will be useless for you to use the framework more quickly in the future.

The framework is easier for us to develop more quickly. However, while using the framework, we also need to learn the basic principles in depth and have a solid foundation.

I think the role of the template tag is to write less php in html.
Php is a very flexible language without the template engine constraints. I feel that the code in the front-end html will be embedded in php in many ways, and some functions may even be defined in it, or some logic is written in it, but there are very few people who use the template engine to do this, whether it's a newbie or not.
Performance does not need to be paid too much attention. Even if the template engine is used, it can be parsed into an html hybrid php format to cache it. Theoretically, after you finish Regular Expression parsing for the first time, the second time you do not need to parse it again.

For frontend and backend separation, the template engine is similar. The cost for front-end developers to learn its usage is far lower than the cost of learning a language.

To make the editor syntax coloring normal

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.