paulredmond / cakephp-twig

TwigView class for CakePHP
19 stars 4 forks source link

TwigView for CakePHP 2 #2

Closed paulredmond closed 12 years ago

paulredmond commented 12 years ago

2.0-wip is getting out of hand, and future work will be done in features to try to break up the work better.

2.0 is still experimental, but the basic goals of this update are functional. The new version does not currently support existing .ctp views very gracefully, but new projects or even plugins that configure Twig as the view class will benefit from new syntax {% extends 'App:Layouts:default.html.twig' %}

Basic Features

Controllers can call render like so:

return $this->render(':Articles:index.xml.twig'); // In this case, you could do App:Articles:index.xml.twig too.

Or a plugin:

return $this->render('Plugin:Controller:file.format.twig');

Todo


Notes

I am still fleshing out the view layer API - really want to bring more consistency than raw helper classes provide. The plugin's Cake shell is not located ATM, so symlinking to app/Console/Command is required. This has been developed mostly in a CakePHP 2.0 environment and testing within the >= 2.1.0 is still needed. Console for warming up template paths is very clunky ATM. Extra checking of App paths is needed because Twig throws an exception if you configure a non-existent path.