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

Guide to creating template helper functions

Discussion in 'XenForo Development Discussions' started by rys, Oct 17, 2015.

  1. rys

    rys Member

    Hi all,

    I want to write a helper function available to my site templates, to help me integrate with a third-party service. I've written the function to work on the data, and I know how to call it from a template.

    How do I package that function up into the right files inside my XF install so that the template language can pick it up? Do I have to register the function anywhere so that XF knows its available to my templates?

    Just looking to tie it all together now really.

    Thanks in advance for any and all help, and sorry for the newbie question!
  2. Chris D

    Chris D XenForo Developer Staff Member

  3. rys

    rys Member

    I'd seen that guide previously but didn't think it applied to XF 1.3+. If it still applies to 1.5, I can't see the Development part of the Admin CP that lets you create new add-ons and event listeners. Sorry if I'm just being really blind and it's right in front of me somewhere.
  4. Chris D

    Chris D XenForo Developer Staff Member

    Good point on the version compatibility. The author of that guide isn't around as much any more but I have just edited it to reflect it is still valid for newer XF versions.

    To enable debug mode, you need to add the following to your XF config.php file:
    $config['debug'] = true;
    rys likes this.
  5. rys

    rys Member

    Excellent, that's worked great. Thanks a lot, and sorry for not realising how to enable debug mode.

Share This Page