assign a Twig global variable

1

Hi, I'm learning to use twig, and I can not assign a variable to use in all the templates, in the documentation it says

$twig = new Twig_Environment($loader);
$twig->addGlobal('text', new Text());

and I use it like that

$twig = new Twig_Environment($loader);
$twig->addGlobal('tsConfig', $tsCore->settings);

and you do not give me anything in the template, how should I do it?

    
asked by Mr. Bombastic 07.03.2017 в 07:15
source

1 answer

0

First of all in the syntax I do not see any problem guiding me from the documentation so the question would be how are you using this variable ??

Look here for twig information in Spanish.

link

    
answered by 07.03.2017 в 17:03