How to create global variable

HappyWorld

Well-known 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.
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>
 
Top Bottom