Add a templating engine like Twig

In the current state templating is plain spaghetti code. PHP interwoven with HTML. Readability is difficult at best. With a solution like Twig things would get dramatically improved. For WordPress already exists a plugin: https://github.com/timber/timber . With its help you get a separation of concerns. You have PHP files responsible for the logic and control and twig files for the presentation. Way easier to read any maintain, improved security through Twig by default, way easier loop construction and in case you ever need to work with time and unix timestamps in WordPress the Twig functionality is nothing but bliss. And the best it is backward compatible. Themes could run built in the old fashioned way without using Twig functionality at all, you could update certain templates adapting to Twig or migrate or write themes from the ground up for Twig.


Read-only archive: https://petitions.classicpress.net/posts/125/add-a-templating-engine-like-twig

Author: rkoller

Vote count: 11

Status: open

Tags:

  • difficulty-hard
  • cp-research-plugin
  • request-add-feature

Comments