• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to create global variable


Active member
How to create global variable which can be used on any template?
My goal is to create 1 variable which detects if user is from US or not, and use it on my template.
$is_us_user = my_function_to_us_visitors_based_on_ip_address();
And in my template
<xen:if is="$is_us_user">

<!-- javascript code for US user -->

<xen:else />

<!-- javascript code for non-US user -->