Good practice is to follow the official Twig global variable guide in the Symfony Cookbook . In practice, you should define a global variable that can be used in controllers, for example:
The variable is then defined as global for Twig templates.
Therefore, {{my_var}}
will return HiAll, but you need to take care of the value once in the parameters.ini
file.
So, the answer to the question: no! Or for sure, inefficient. MDrollette made the way possible!
source share