XF 1.1 Addons & Templates

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.
 
My question is can addons manipulate these templates?

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:

http://xenforo.com/community/threads/how-to-create-a-bridge.28515/#post-331631
http://xenforo.com/community/threads/adding-own-thread-search-criteria.20193/#post-261191

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:

Code:
$config['debug'] = 1;
 
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?
 
The TMS addon does this. Maybe I am misunderstanding.

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?

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.
 
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.
 
Top Bottom