Fidel Castro Fidel Castro - 4 months ago 40
Smarty Question

How to assign variables in twig?

Im migrating my code from smarty to twig

but I dont seem to find how to do this in twig



how can I do this in Twig ?


You would use 'set'. Then you would have to pass in $Core->settings as a variable from your controller like so:

return $this->render('my_template.html.twig', array(
        'core_settings' => $Core->settings,

Then in my_template.html.twig you would use set like this:

{% set 'Config' = core_settings %}

I'm not sure if that works for you, Twig is different than smarty (I'm not very familar with smarty) but Twig is powerful.