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

How to register variables to use in template modifications?

Discussion in 'XenForo Development Discussions' started by Lior., Jun 30, 2013.

  1. Lior.

    Lior. Well-Known Member


    I'd like to use some custom variables in a template modification.

    How can this be done?

  2. Chris D

    Chris D XenForo Developer Staff Member

    Either way it will require some element of PHP knowledge.

    There's a possibility you could do it using {xen:callback tags (new - I haven't used these myself yet) or you could extend Controllers using an add-on. When you extend a controller you can call the parent and add additional variables to the view.

    You can also use template hooks and the template post render event but certainly the former of the two is now deprecated and as such you cannot guarantee they'll be around forever.
  3. Lior.

    Lior. Well-Known Member

    I don't mind using PHP, it's just that I'm new to XenForo and I'm just starting to learn it, so you'll have to forgive me.

    How would I actually go about adding the additional variables to the view?
  4. Lior.

    Lior. Well-Known Member

    Alright, figured it out, thanks.
  5. Jon Peters

    Jon Peters Member

    Can you please post how to do so. New to XenForo and trying to figure out how to assign from my php addon.

Share This Page