Reputation: 11
I'm using Symfony2 for a few days, this is my problem, I created a bundle, now I would like to know how do I set the parameters that will be used to twig before rendering the template? That is, I want to insert a file bundle configuration parameters that specify whether the template should have 1 or 2 columns, or whether it should or not to display the menu in the left column. I hope I was clear enough.
thanks
Upvotes: 0
Views: 226
Reputation: 41934
With twig extensions, you can create your own twig functions, filters, tests or global variables. But Symfony2 also provides an easy way to set global variables: http://symfony.com/doc/current/cookbook/templating/twig_extension.html
twig:
# ...
globals:
ga_tracking: UA-xxxxx-x
Upvotes: 1