I was creating a website when I had the bright idea of pre-creating a webpage template and then filling in the values that I needed. At first I was going to roll my own, and then I realized that there were many PHP templating engines in existence already. I decided to give Twig a try since it seemed to be well-known.
http://devzone.zend.com/1886/creating-web-page-templates-with-php-and-twig-part-1/
- Twig example.
- Shows the basics.
- Unfortunately, does not demonstrate a straightforward loop.
http://readwrite.com/2010/08/31/twig-templating-engine-quick-s#awesm=~opErZeZWdq7zLX
- It’s almost crap.
- Despite its claims, for a five minute guide, it doesn’t show the basics like how to include the dependencies. In addition, the code throws an error if you put it in a try-catch block.
- However this sample does show how to create a template with a loop.
- The error disappeared when I replaced display/print with render/echo. I wonder if the error hid itself or did I really fix it.