Answer the question
In order to leave comments, you need to log in
Which template engine for PHP to choose?
I understand and know that PHP is already a templating engine in itself, but the question is still the same. Which ones did you use, which ones are used in frameworks? What is the point of dividing the layout into over9000 pieces and then running through the files in search of the desired element (I hated PrestaShop after that)? Now, in fact, there is a choice between using a template engine and the old-fashioned code: all calculations until the html output, and then directly the output itself in the same module with ifs, foreachs and other joys (but without queries to the database and layout in variables) . Where can you win in terms of speed (and is it necessary)?
Answer the question
In order to leave comments, you need to log in
Where can you win in terms of speed (and is it necessary)?in terms of speed, clean puff will be faster.
What is the point of dividing the layout into over9000 pieces and then running through the files in search of the desired elementin code revision. normal template engines support template inheritance, which avoids duplication of almost identical pages.
TWIG ( https://twig.symfony.com/ ) is a good templating engine. I used it once when developing my framework in PHP
I confirm, Twig is good. If you are using Laravel, but too lazy to screw Twig, then Blade.
I recommend the good old Smarty. It is somewhat slower than Twig, but in my opinion it has a more sane syntax and is much easier to extend.
In my projects I use twig ( https://twig.symfony.com/), in my projects, pure php is at work, the only minus of template engines is that you can’t just copy html from the Internet and paste it, for example, I used twitter bootstrap and I had to rewrite each example on twig.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question