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

Esteban Filardi

I'm using Symfony2.

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

Thanks.

Anton Babenko

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

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

From Dev

How can I access to parameters.yml content within a custom twig extension

From Dev

How can I access URL parameters from within a BasePermission?

From Dev

Twig (in Symfony) : access template parameters from twig extensions

From Dev

How I can access to the parameters of an URL within of an iframe?

From Dev

How to force locale timezone (from parameters.yml) in twig dates?

From Java

How can I use break or continue within for loop in Twig template?

From Dev

How can I access GET parameters?

From Dev

How can I access Unpermitted Parameters?

From Dev

How do I access parameters and methods defined across two interface from a class that implements those two interfaces?

From Dev

How to access list of Jenkins job parameters from within a JobDSL script?

From Dev

can I display parameters value ($_POST, $_GET, $_SESSION, $_SESSION) using twig template engine component

From Dev

How do I access variadic template parameters in a way that is constexpr compatible?

From Dev

How do I access variadic template parameters in a way that is constexpr compatible?

From Dev

How can I get parameters to automatically appear within brackets?

From Dev

How can I call a variable function within a function with parameters?

From Dev

How can I specify non-deducible template parameters on a constructor?

From Dev

How can I pass floating point numbers as template parameters?

From Dev

How can I pass floating point numbers as template parameters?

From Dev

How to read parameters from parameters.yml in a service?

From Dev

How can I access the attribute from the template?

From Dev

How can I access the attribute from the template?

From Dev

How can I access query parameters for the Health endpoint?

From Dev

How can I access multiple parameters that have been passed to a function?

From Java

Access control in template parameters

From Dev

How do I access the parameters from json API in Rails?

From Dev

How to access entity functions with parameters in TWIG - symfony2

From Dev

How can i send parameters to validators.lang.yml in symfony2 validator engine?

From Dev

Access template parameters in another template

Related Related

  1. 1

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

  2. 2

    How can I access to parameters.yml content within a custom twig extension

  3. 3

    How can I access URL parameters from within a BasePermission?

  4. 4

    Twig (in Symfony) : access template parameters from twig extensions

  5. 5

    How I can access to the parameters of an URL within of an iframe?

  6. 6

    How to force locale timezone (from parameters.yml) in twig dates?

  7. 7

    How can I use break or continue within for loop in Twig template?

  8. 8

    How can I access GET parameters?

  9. 9

    How can I access Unpermitted Parameters?

  10. 10

    How do I access parameters and methods defined across two interface from a class that implements those two interfaces?

  11. 11

    How to access list of Jenkins job parameters from within a JobDSL script?

  12. 12

    can I display parameters value ($_POST, $_GET, $_SESSION, $_SESSION) using twig template engine component

  13. 13

    How do I access variadic template parameters in a way that is constexpr compatible?

  14. 14

    How do I access variadic template parameters in a way that is constexpr compatible?

  15. 15

    How can I get parameters to automatically appear within brackets?

  16. 16

    How can I call a variable function within a function with parameters?

  17. 17

    How can I specify non-deducible template parameters on a constructor?

  18. 18

    How can I pass floating point numbers as template parameters?

  19. 19

    How can I pass floating point numbers as template parameters?

  20. 20

    How to read parameters from parameters.yml in a service?

  21. 21

    How can I access the attribute from the template?

  22. 22

    How can I access the attribute from the template?

  23. 23

    How can I access query parameters for the Health endpoint?

  24. 24

    How can I access multiple parameters that have been passed to a function?

  25. 25

    Access control in template parameters

  26. 26

    How do I access the parameters from json API in Rails?

  27. 27

    How to access entity functions with parameters in TWIG - symfony2

  28. 28

    How can i send parameters to validators.lang.yml in symfony2 validator engine?

  29. 29

    Access template parameters in another template

HotTag

Archive