user3137568
user3137568

Reputation: 11

Symfony2, bundle, parameters twig

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

Answers (1)

Wouter J
Wouter J

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

Related Questions