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

how do I use xen:helper getFileExtension in my template?

Discussion in 'XenForo Development Discussions' started by MainFrame, Oct 11, 2010.

  1. MainFrame

    MainFrame New Member

    Hi Guys,

    I'm trying to get a file extension from a file using the getFileExtension helper.
    I tried {xen:helper getFileExtension, $file.filename}
    The $file.filename variable is set but it ain't working.

    Any ideas?
  2. Indigo

    Indigo Active Member

    getFileExtension is not listed as a helper callback in XenForo/Template/Helper/Core.php (what {xen:helper} uses).

    I'm not 100% on this, but adding the following PHP code somewhere before rendering may work:
    XenForo_Template_Helper_Core::$helperCallbacks['getfileextension'] =
    Make sure the getfileextension stays in all lower-case. This should enable the getFileExtension helper for templates (and technically you could do this for any other functions you need in templates).
    MainFrame likes this.
  3. MainFrame

    MainFrame New Member

    Thanks Indigo, that did the trick :)

Share This Page