[Wikitech-l] Code style: overuse of Html::element()

Antoine Musso hashar+wmf at free.fr
Tue May 14 09:34:49 UTC 2013


Le 14/05/13 02:23, Jon Robson a écrit :
> Following on from Antoine's post, I experimented recently with using a
> template engine Mustache that works on both javascript and PHP and
> allows separation of HTML templates from PHP code.

Another template engine is Twig. It is used by the Silex micro engine
(based on Symfony2).  See: http://twig.sensiolabs.org/

Examples:

 {{ foobar }}  # not escaped
 {{ unsafevar|escaped }}  # yeah protection!

 You can iterate:

 <ul id="users">
 {% for user in users %}
   <li><a href="{{ user.href }}">{{ users.name }}</a></li>
 {% endfor %}

The problem is that it is just for PHP whereas Mustache has
implementations in Javascript as well.


-- 
Antoine "hashar" Musso




More information about the Wikitech-l mailing list