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

Unmaintained Global Template Variable 1

How to create variables that can be accessed in all templates

  1. semprot

    semprot Active Member

    semprot submitted a new resource:

    Global Template Variable - How to create variables that can be accessed in all templates

    Read more about this resource...
    bousaid, Mirovinger and Walky like this.
  2. Walky

    Walky Member

    Thanks You :D
  3. tonnyz

    tonnyz Member

    Can I use this to make other existing variables available to be retrieved on all templates ?

    Let's say I wanna use existing $thread value in my 'navigation' template.
    (the $thread value is retrieved from the corresponding page the navigation currently sits, indeed)

    How can I achieve this with your add-on ?

    PS: $thread variable is not available in 'navigation' template

  4. semprot

    semprot Active Member

    I don't think existing variables that are specific on specific templates can be made available on all templates using this method :)
    However i could be wrong because i'm still learning XF too :D
  5. Chuck Day

    Chuck Day Member

    Thanks for the simple example. I was trying make available a custom pulldown menu throughout the templates and was struggling with the syntax.
    semprot likes this.
  6. semprot

    semprot Active Member

    I'm glad this helps. :)
  7. Cyb3r

    Cyb3r Well-Known Member

    Hey @semprot, can I use this with custom userfields to call it anywhere in the forums?

    This will really help me with a major issue. :)
  8. semprot

    semprot Active Member

    If you meant reading custom user fields within "template_create" function, i have tried to read $user & $visitor there, but it seems both variables are not recognized.
    So there must be other way.
  9. Cyb3r

    Cyb3r Well-Known Member

    I know what I need but I don't know which way is better, I have also read the helper guide which can be found HERE but I don't know how to make it works, What I want is to create custom field for members to choose their user colors, and that color would show on every page of the site, like replacing usergroup color with the one chosen in the options.
  10. semprot

    semprot Active Member

  11. Cyb3r

    Cyb3r Well-Known Member

    Okay thanks buddy for trying to help. :)
    semprot likes this.

Share This Page