Global Variables

I’m currently trying to read the value of a cookie which needs to be accessible on several instances (e.g. template/tpl.php and snippets/snip.php). Instead of checking the cookie multiple times I’d like to put the value into a variable.

How can I add a variable to be accessible on every snippet used in a template?

The site-controllers doesn’t seem to do the trick since it gets overwritten by other controllers.
Copy-pasting the code into every controller doesn’t feel right, especially when stuff needs to be changed.

Maybe this will help?

I’d just call a function that returns the desired value.


@texnixe Seem to be the most simple solution for now! Thanks!