A presentation at WordCamp Norway 2014 in January 2014 in Oslo, Norway by Andrey Savchenko
2 Andrey “Rarst” Savchenko • Rarst.net ♦ WPSE ( s.tk/wp ) • QueryPosts.com • Composer.Rarst.net
Why would I need another templating engine when PHP is already one?
Why would I need another programming language when PHP is already one?
5 WordPress theme dev is more than PHP 1. template hierarchy 2. template tags API
nana nana nana nana nana nana nana nana [gallery] !
7 “ Innovation in WordPress templating is dead WordPress look, you know? • get_template_part() — in WP 3.0 (2010) • theme wrappers — around WP 3.2 (2011) Nothing in last 3 years & 8 major releases
8 Featuritis cheat sheet • sandboxing • default escape • template inheritance
9 Abstractions Protect you from code. Constraints Protect you from yourself.
11 Mustache — entry to templates & facial hair 1. context 2. “logic-less” template mustache.github.io
12 Mustache — example {{#posts}} <li>{{post_title}}</li> {{/posts}} {{^posts}} <li>No posts</li> {{/posts}}
13 Twig — pack leader of PHP templating 1. context 2. loader (lexer, parser, compiler) 3. template (filters, functions, macros, and more) twig.sensiolabs.org
14 Twig — example {% for post in posts %} <li>{{post.post_title}}</li> {% else %} <li>No posts</li> {% endfor %}
15 Timber — WordPress + Twig 1. context in PHP template 2. Twig template 3. OOP context access API timber.upstatement.com
16 Timber — example {% for post in posts %} <li>{{post.title}}</li> {% else %} <li>No posts</li> {% endfor %}
17 Meadow — WordPress templating DSL 1. template hierarchy 2. template tags API 3. DSL API bitbucket.org/rarst/meadow
18 Meadow — example {% loop %} <li>{{ the_title() }}</li> <!-@TODO {% else %} <li>No posts</li> --> {% endloop %}
Are my templating needs being met with adequate tools?
20 Burst the bubble! Questions? • @Rarst • The Loop ( s.tk/chat ) Rarst.net/slides/templating
View Lies, Damned Lies, and No Need for Templating Engine on Notist.
Dismiss
The following resources were mentioned during the presentation or are useful additional information.
Original slides for the talk.
Meadow is a theme templating solution, aiming to find a balance between native WordPress concepts and power of Twig dedicated templating language.
Here’s what was said about this presentation on social media.
Lies, Damned Lies and No Need for Templating Engine by @Rarst upstairs now. #wcnorge— WordCamp Oslo (@WordCampOslo) January 25, 2014
Lies, Damned Lies and No Need for Templating Engine by @Rarst upstairs now. #wcnorge
Thanks to @rarst for the @timberwp shout-outs. Some bugs are features, but I take the criticisms to heart. http://t.co/Fs3DReZEuc— Jared Novack (@jaredNova) January 25, 2014
Thanks to @rarst for the @timberwp shout-outs. Some bugs are features, but I take the criticisms to heart. http://t.co/Fs3DReZEuc
Really enjoyed @Rarst's talk on template languages (even if I disagree) check out his new project: Meadow https://t.co/zFRIrGnkn4 #wcnorge— Timber for WordPress (@TimberWP) January 25, 2014
Really enjoyed @Rarst's talk on template languages (even if I disagree) check out his new project: Meadow https://t.co/zFRIrGnkn4 #wcnorge
Choose a pill with @rarst at #wcnorge pic.twitter.com/bU1zPHuh3m— Paul de Wouters (@paul_wp) January 25, 2014
Choose a pill with @rarst at #wcnorge pic.twitter.com/bU1zPHuh3m