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

WordPress Trac noreply at wordpress.org
Fri Aug 21 00:04:14 UTC 2015


#33472: Templating Engine
-----------------------------+---------------------------------------
 Reporter:  KalenJohnson     |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Themes           |     Version:  trunk
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:  administration, template
-----------------------------+---------------------------------------

Comment (by brentjett@…):

 Template syntaxes are a tough commitment. There are some pretty heavy cons
 to deal with. Here’s how I see it:

 Pros:
 * Simpler syntax for themers, declarative instead of logical. Themers (the
 majority) are not programmers and it helps to admit it.
 * Secure - Template languages can be sandboxed to prevent bad practices
 and hacks prone to php files.
 * Machine writable - These “tag” driven languages are a lot easier to
 write programmatically. I’m of the opinion that WordPress should one day
 become the best environment for creating themes as well as consuming them,
 and being able to write templates programmatically is a big step toward
 that.
 * A template syntax could be merged with the shortcode syntax so the two
 become interchangeable which will help end users warm up to theming.

 Cons:
 * Often template languages are too simplistic. It’s difficult to express
 complex conditions or prepare data without resorting to a logical
 language. This has the potential to be severely limiting.
 * This requires a different environment from the logical one used to setup
 theme configuration and define plugins. Forces developers to learn
 multiple syntaxes. (BTW - Theme configuration like theme supports and
 enqueuing really SHOULD be moved into a declarative language like JSON)
 * Unlike PHP, plain text files like json or twig are publicly accessible
 without special server setup to block viewing them. Themers would probably
 need to learn new security best practices.

 All that said, twig is a very interesting language, solves several
 problems, and also introduces some. Squarespace has an interesting syntax
 (JSON-T) that is paired with JSON data for structure. I’d be interested in
 working on moving theme configuration settings into a declarative syntax
 like JSON before really diving into templating langs.

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


More information about the wp-trac mailing list