Serhioromano / cobalt-9

Cobalt 9 Beta Test Group
11 stars 2 forks source link

Twig as template alternative to PHP #138

Closed kiranetph closed 5 years ago

kiranetph commented 5 years ago

Discussion to use Twig as alternative for templates since it became very popular with other CMS (Drupal, Wordpress, October CMS, GRAV, etc ) and might lower the bar for template customisation.

Resources: Using Twig as render engine for Joomla extensions: https://www.slideshare.net/phproberto/using-twig-as-rendering-system-for-your-joomla-extensions Presentation Video: https://www.youtube.com/watch?v=nXn7PjQH8is Joomla plugin https://github.com/phproberto/joomla-twig Documentation: https://phproberto.github.io/joomla-twig/

Twig documentation: https://twig.symfony.com/doc/2.x/

Serhioromano commented 5 years ago

I am sorry to say, but popularity cannot prove its value. This is a very old topic. Template systems like this pops up here and there from time to time and gain popularity by those who know less.

this popularity is not for long. Systems like this have few issues.

One most important is template parsing. The template has to be parsed and precompiled before rendering. And you have to remember patTemplate section and how long we eliminated it from Joomla and how slow Joomla was with it.

Templates like this limits flexibility. All your variables have to be ready for template, you cannot add some logic to it, so you will have to hack PHP file. Right now in a template you can create another small application.

And another reason, even if there were no issues above, imagine the amount of work to be dome to switch to this template system and at the end you make Cobalt depend on something else, and if it fails, or stop supporting, then you have to refactor everything back.