[wp-trac] [WordPress Trac] #33472: Templating Engine

WordPress Trac noreply at wordpress.org
Thu Aug 20 21:01:37 UTC 2015


#33472: Templating Engine
--------------------------------------+-----------------------------
 Reporter:  KalenJohnson              |      Owner:
     Type:  feature request           |     Status:  new
 Priority:  normal                    |  Milestone:  Awaiting Review
Component:  Themes                    |    Version:  trunk
 Severity:  normal                    |   Keywords:
  Focuses:  administration, template  |
--------------------------------------+-----------------------------
 Templating engines are being used everywhere, not just in other languages,
 but nearly all other PHP frameworks and CMS's that are actively
 maintained. Even Drupal 8 will be rolling out [https://www.drupal.org
 /theme-guide/8/twig Twig integration].

 I wasn't able to find an actual discussion about this on Trac, so I
 definitely wanted to open the discussion. Should WordPress integrate a
 templating engine?

 The benefits are obvious:
 * Automatic escaping. No more escaping all the things every single time.
 * Easier to read. This is sometimes down to personal opinion, but I and
 many others do find templating engines much easier to read than PHP
 templates
 * Better separation of logic from templates. This isn't a guarantee, and
 depends on how strict the templating engine is, but it does help reinforce
 this.

 Cons:
 * More to learn. I don't know '''how much''' more, but it is something to
 take into account
 * Speed? I haven't looked up benchmarks lately, but another thing to
 potentially keep in mind
 * Backwards compatibility. However this could be mitigated if
 plugins/themes had the option to use straight PHP or the templating
 engine.

 There are many options available, Smarty isn't widely used anymore, but
 there is (http://twig.sensiolabs.org/ Twig) which is probably the most
 adopted, and (http://laravel.com/docs/5.1/blade Blade) has become rather
 popular.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33472>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list