views:

14

answers:

0

I've just started looking into Twig and I'm wondering how I would accomplish the following.

I have a variable $logged_in that I need to have access to in every single page on my site, I was hoping that rather than passing this to the twig renderer every single time in the data array, there would be a way for me to declare this somewhere, and for every template to have access to it.

Do I need to build an extension to accomplish this / or is it even possible? I have looked through every page of the documentation but I'm having trouble having tried to extend the base template as described here...

Twig Documentation | Recipes | Making the Templates aware of the Context

Is this the right approach?

Thanks