1. 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

Discussion in 'XenForo Development Discussions' started by semprot, Aug 4, 2014.

  1. semprot

    semprot 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.
    And in my template
    <xen:if is="$is_us_user">
    <!-- javascript code for US user -->
    <xen:else />
    <!-- javascript code for non-US user -->
  2. Nobita.Kun

    Nobita.Kun Well-Known Member

    Using listener `template_create` then you assign your params into containter params.
    semprot likes this.
  3. semprot

    semprot Active Member

    I'm still quite lost, i have enabled development mode, should i use controller listener / model listener to put my php code?

    Thank you.


  4. semprot

    semprot Active Member

    nvm i get it working, thanks to widget framework code, i learnt from it :D
    Nobita.Kun likes this.
  5. Walky

    Walky Member

    Certainly too late :S but How did you do this ?
    Apocalypse likes this.
  6. semprot

    semprot Active Member

    Walky likes this.

Share This Page