📜 ⬆️ ⬇️

Template engines


Once again I will raise the topic of the Template Engine in PHP. I'm afraid there will be a holivar ...

Recently, I notice a tendency that a beginner PHP developer (grievingly saying that not only a beginner) considers it his duty to insert Smarty or another Template Engine in each project, and then prove with foam at the mouth that it is necessary to separate the logic and the display. So - for starters, you should in your head share the logic from the presentation, and not scream - "I am smart, I share."

Another misconception is that the coder / designer doesn’t understand PHP tags, but he will understand Smarty - ask your coder’s friends, they don’t have any particular difficulty using PHP, and as an example I can give Wordpress - there are a lot of topics for him, and by no means PHP developers written.

I will give an example from the same manual on smarti:

Another disadvantage of Smarty is PHP4, which after 08.08.08 will not even crash ...
')
And the fact that the IDE is not friendly with Smarty and others like it - it just pisses me off (even if you set up the backlight, you cannot see the navigation through the classes and functions)

What is the alternative? Look at Zend_View - a beautiful implementation of a native PHP template engine with syntax.

PS Looking back at your previous post about the ranks of developers , you can use this for PHP:


Update :
  1. template engine is just a tool for the separation of logic and display - if you don’t understand how to wield this tool with a tool, then nothing sensible
  2. use template engines with native PHP syntax (Zend_View is given as an example of one)

Source: https://habr.com/ru/post/30675/


All Articles