Hello everyone!

We have been investing plenty of personal time and energy for many years to share our knowledge with you all. However, we now need your help to keep this blog running. All you have to do is just click one of the adverts on the site, otherwise it will sadly be taken down due to hosting etc. costs. Thank you.

Assuming that you want to print a parameter value in a or all twig files.


Parameters


# app/config/parameters.yml
parameters:
project_name: Sport

Config


# app/config/parameters.yml
twig:
globals:
project_name: %project_name%

Twig view


This will print "Sport".


# src/Football/FrontendBundle/Resources/views/Default/index.html.twig
{{ project_name }}