web - Is it better to use the built-in template engine or smarty for thinkphp development?
某草草2017-05-16 13:11:26
0
3
725
Is it better to use the built-in template engine or smarty to develop thinkphp3.2.3? But using smarty seems to be very troublesome to achieve perfect compatibility
I personally came into contact with tp first. Later, in some small projects, I felt that tp was overqualified but needed template rendering, so I came into contact with smarty.
The difference between these two templates is not very big, tp draws on smarty in a great sense. If it is a new development, just choose it according to the usage habits of the front-end personnel. The grammatical difference between the two is very small.
I usually use Smarty when writing native PHP and need to render it. If I use TP to write projects, I just use the engine that comes with TP.
Honestly, both are not very good. They are both fake separation of static and dynamic. It is still better to directly make the API, and then load and render the page asynchronously. You can use traditional JS native code and jQuery ajax, or you can use some frameworks such as vue and react. This is good practice. . Personal advice, don’t complain if you don’t like it, because once you get used to programming thinking, it is difficult to change it. . .
I still think the built-in one is better. In fact, the syntax is similar. However, I have encountered before that certain features are only supported by my own template engine, not Smarty...
I personally came into contact with tp first. Later, in some small projects, I felt that tp was overqualified but needed template rendering, so I came into contact with smarty.
The difference between these two templates is not very big, tp draws on smarty in a great sense. If it is a new development, just choose it according to the usage habits of the front-end personnel. The grammatical difference between the two is very small.
I usually use Smarty when writing native PHP and need to render it. If I use TP to write projects, I just use the engine that comes with TP.
Just feel free to do it.
Honestly, both are not very good. They are both fake separation of static and dynamic. It is still better to directly make the API, and then load and render the page asynchronously. You can use traditional JS native code and jQuery ajax, or you can use some frameworks such as vue and react. This is good practice. . Personal advice, don’t complain if you don’t like it, because once you get used to programming thinking, it is difficult to change it. . .
I still think the built-in one is better. In fact, the syntax is similar. However, I have encountered before that certain features are only supported by my own template engine, not Smarty...