How to register variables to use in template modifications?

Lior.

Well-known member
Hi,

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

How can this be done?

Thanks.
 

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.
 

Lior.

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