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

Easier way to amend same occurrence in many templates?

Discussion in 'XenForo Development Discussions' started by arms, Jun 20, 2014.

  1. arms

    arms Active Member

    I want to amend:

    {xen:helper threadPrefix, $content}{$content.title}

    {xen:helper threadPrefix, $content}{xen:helper threadPrefix2, $content}{$content.title}
    Is there a better way than many template modifications?
  2. Chris D

    Chris D XenForo Developer Staff Member

    Would it be possible to amend the default threadPrefix helper?

    You would effectively be overwriting the helper, I haven't looked at the code but you could start with something like:

    public static function helperThreadPrefix($arg1$arg2)
    $prefix1 XenForo_Template_Helper_Core::helperThreadPrefix($arg1$arg2);
    $prefix2 self::helperThreadPrefix2($arg1$arg2);

    $prefix1 $prefix2;

    public static function 
    // threadPrefix2 code here.
    return '';
    So, with that set up, you probably don't need to modify any templates.
  3. arms

    arms Active Member

    Never thought of that. :rolleyes:

    What listener would i use? init_dependencies ?
  4. Chris D

    Chris D XenForo Developer Staff Member

Share This Page