• 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

semprot

Active member
#1
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.
PHP:
<?php
$is_us_user = my_function_to_us_visitors_based_on_ip_address();
?>
And in my template
HTML:
<xen:if is="$is_us_user">

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

<xen:else />

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

</xen:if>