no-framework-tutorial/9-templating.md

15 lines
1.1 KiB
Markdown
Raw Normal View History

2014-10-06 20:48:28 +00:00
[<< previous](8-dependency-injector.md)
### Templating
2014-10-07 20:59:11 +00:00
A template engine is not necessary with PHP because the language itself can take care of that. But it can make things like escaping values easier. They also make it easier to draw a clear line between your application logic and the template files which should only put your variables into the HTML code.
2014-11-06 19:47:42 +00:00
A good quick read on this is [ircmaxell on templating](http://blog.ircmaxell.com/2012/12/on-templating.html). Please also read [this](http://chadminick.com/articles/simple-php-template-engine.html) for a different opinion on the topic. Personally I don't have a strong opinion on the topic, so decide yourself which approach works better for you.
2014-10-08 17:08:26 +00:00
For this tutorial we will use a PHP implementation of [Mustache](https://github.com/bobthecow/mustache.php).
Other well known alternatives would be [Twig](http://twig.sensiolabs.org/) or [Smarty](http://www.smarty.net/), but they are both pretty bloated and offer too much functionality for just a template engine.
2014-10-07 20:59:11 +00:00
to be continued...
2014-10-06 20:48:28 +00:00
[<< previous](8-dependency-injector.md)