Benjamin Piscart
Benjamin Piscart

Reputation: 3

Access a php global in twig template

I need to access a global defined with php function define(MY_GLOBAL, 'foo'); in a twig template. I can't use the detour $app['twiq']->addGlobal(); because I'm in my config file

Any ideas ?

Upvotes: 0

Views: 1116

Answers (1)

deceze
deceze

Reputation: 522005

That's not a global, that's a constant. For accessing constants, there's the aptly named constant():

{{ constant('MY_GLOBAL') }}

Upvotes: 4

Related Questions