Skip to the content
Documentation

Re: How to define global variables

No ratings yet

Thanks for your research.
It really logical, but I had to try a few times before it got to me:
You need to declare the variable in pagelayout.tpl to access it in templates on same or higher level than the one that sets it.

Comments (1 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Re: Re: How to define global variables

    Jon Ramster ·

    Thank you, thank you, thank you. Very, very frustrating until I came across this point.
    This is key point and SHOULD BE EMPHASISED VERY STRONGLY. I had a template calling another sub-template. This sub-template was setting a global variable. This didn't work until I defined the variable before the include, which then gave the variable a value and set its scope as 'global'.
    This seems incredibly counter-intuitive to me, but I would love for someone to explain why this is the way it is.