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

XF 1.1 Addons & Templates

Discussion in 'XenForo Questions and Support' started by ScopeXL, Jul 3, 2012.

  1. ScopeXL

    ScopeXL Member

    I am new to XenForo and really like how it handles hooks into the templates. My question is can addons manipulate these templates? Say I want to use the Template Modification System addon and I install an addon that does not have a TMS xml file. Would I need to go through each template that was modified and add a TMS entry? The goal being not to worry about templates possibly being out of date. I am not sure if it is worth the effort or just manually re-add template edits on XenForo updates.

    Apologies if this doesn't make sense. Again, I am new to XenForo and am still learning.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Yes. You can create listeners for code events to manipulate the templates without modifying them.

    Admin CP -> Development -> Code Event Listeners

    Here are some code examples for the template events:


    Note that the Development tab only shows when debug mode is enabled. To enable debug you need to add this line to your library/config.php file:

    $config['debug'] = 1;
  3. ScopeXL

    ScopeXL Member

    So basically I would need to add a callback listener for each template edit? There would be no way to stop the edits so I don't have to compare the 2 template files and revert them back to default?
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The TMS addon does this. Maybe I am misunderstanding.

    I wouldn't think so. I actually haven't used the TMS before, but I can only assume it doesn't interfere with normal template hooks and events which are used by addons. Few addons require you to manually apply template edits. They usually use hooks and events for template changes which don't require any extra consideration on your part during installation or upgrading. So basically don't worry about it.
  5. ScopeXL

    ScopeXL Member

    Ah ok, that makes more sense. Recently I got the notice a template was marked as outdated and I started reading about the TMS addon and how it makes it so it will apply template edits without messing with the actual template so XenForo can update flawlessly every time. I see your point though there are more hooks than not, TMS may only be useful for my manual edits instead of mods. Thank you for your help.

Share This Page