by RichardM » Thu Nov 03, 2011 2:23 pm
Hi,
I did look at doing this very early on with DooPHP (talking about 2 years ago now) and I don't have any code to offer up to hand.
However, from what I recall I pretty much did the following:
1) Setup a base controller for my app (extending DooController) which all my other controllers would then extend
2) In the base controllers constructor I initialised Twig's template engine using the code from there samples
3) Added a new render method say renderViewWithTwig($view)
4) Added a couple of utility functions etc to set values to be made available within the Twig templates
5) extended the base controller and called the renderViewWithTwig method
As for the code to go inside the functions I mainly chopped it out of the Twig sample code. It didn't make full use of the template engine but I suspect with some more work one could add it in. Alternatively you could create your own View class and use this like the DooView and DooViewBasic classes but a DooViewTwig
Richard
Note: code samples my not be 100% accurate.