This plugin tries to integrate the Twig into Symfony
To get support for Syntax highligting when coding in the twig "language" it is desireable to install Django HTML syntax highlighting support, which will highlight both the html and the twig code. There will might be some glitches though.
This is a HUGE project for one man, so if YOU want to contribute in any dont hesitate to fork me or open an issue or contact med at yep [at] iamhenrik.se
. The first really big thing that needs help is porting the Core and Standard helpers for Symfony to Twig Extensions either as tags or filters.
Create a file named module.yml
in project/config
or app/config
dir with the following content.
all:
view_class: sfTwig
partial_view_class: sfTwig
This will enable the sfTwigView class to be used when rendering templates.
Usage is simple, this plugin replaces sfPHPView and therefor the template file extension have changed into .html. But because this is not exactly the same as sfPHPView and Twig dosent allow function calling from within the templates none of the normal helpers will work until they have been converted to Twig Extensions.
To Generate the port of symfony helpers into Twig Extensions do the following:
./symfony twig:helpers
This script will scan the symfony helper folder and with create Twig Extensions based on them inside the ./lib/extensions folder of the plugin. sed, awk & php must be in the path.
Then in order to use the UrlHelper with Twig you can do:
$twig->addExtension(new Url_Twig_Extension());