Answer the question
In order to leave comments, you need to log in
Which templating engine to take for a new php project?
Many people use Smarty by inertia, someone tries Twig, someone - exotic Blitz, so I want to know the opinion of the public.
Blitz, in my opinion, has a significant drawback - high labor costs for development, since it requires close interaction between the designer and the programmer for changes and for rapid development / prototyping, in my opinion, is not very suitable.
From Smarty-like systems, I only know Twig, maybe there are other good options? From the template engine I want objectivity and extensibility.
Answer the question
In order to leave comments, you need to log in
A good templating engine that perfectly integrates with PHP is called... PHP :) It is convenient to use alternative syntax in templates.
I recommend XSLT. For it, you can assemble an XML-ku using a SimpleXML thread - very convenient. Each module of the project can insert its data into the same SimpleXML object and then XSLT already selects what it needs.
Of the pluses - it is well transferred between languages (if you suddenly need it), you can use the same XSLT to try to implement the REST API. Yes, it just imposes a fairly correct style when creating templates. Again, for NGINX there are modules for XSL transformation inside it (although I personally don’t see the point of doing templating inside a lightweight asynchronous web server
). will fly.
Twig - template inheritance, compiling templates into a readable form (class), all the best from Smarty, sandbox, auto-escaping strings, there are ready-made classes for integration in almost all frameworks. Blitz - it’s very inconvenient to work with templates, it seemed to me very tight for development. The speed of Blitz... this is a dubious advantage - compiled templates twig + eAccelerator will not be inferior to Blitz.
I wondered all the time why in PHP people are looking for some kind of templating engines.
the language itself is a powerful templating engine.
everything else, except for XSLT + XML - from the evil one.
Can look towards XSLT? Very high separability of code from presentation. In terms of speed, it will probably be slower than the above. But the convenience of working with him often crosses out all the minuses.
CTPP2
Pros:
- high speed
- extensibility (you can add your own functions)
- one set of data for templating on the server and on the client (JSON)
- a module for templating using nginx has recently appeared, it is not production-ready yet, but I think it will quickly become one
I don’t understand why template engines on puff are better and more convenient than puff itself.
Quicky:
habrahabr.ru/blogs/php/45337/code.google.com/p/quicky/wiki/Manual
I have published quicky reviews
.
I have been using for 2 years
Now a lot of people are looking towards HAML + SASS.
These languages come from the world of Ruby and now there are adaptations for almost every major language.
For example, for PHP you can look at phphaml.sourceforge.net/ , www.yiiframework.com/extension/haml-and-sass/ and so on.
Another plus in the direction of Smarty: Eclipse + Smarty Plugin = free and convenient bundle. After switching to Mac, this is the only comfortable IDE for puffing.
The general answer for those who unsubscribe that "PHP itself is a good template engine":
You either did not work with large projects, or I sympathize with those who support them. Separation of logic and presentation by default should be. XSLT+XML - suitable; Smarty, Twig - too. But the CODE in HTML is really from the evil one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question