2
votes

I'm using Symfony2.

How can I access parameters defined in parameters.yml from within a twig template ?

Thanks.

1

1 Answers

5
votes

Define it in config.yml like this:

twig:
    globals:
        some_key: %some_key%

and then use in twig files like:

{{ some_key }}

For security reasons you can't get access to data from parameters.yml in the templates without defining global twig variables.