XF 1.2 So how does the TM work?

Code Monkey

Well-known member
I added a simple template modification that I am using on my 1.1.5 site with TMS to the 1.2 Template modifier and it doesn't work. It says compilation error. Yet when I hit the test button it shows it as working.

Any ideas?
 
Last edited:
Editing the core templates with the new TM system is absolutely the preferred way going forward. Moving elements to extra.css or some other custom css template makes it very difficult to make sure code snippets are being upgraded properly with new versions. Prior to the TM system, one had to be very methodical that they didn't miss anything. Now with the TM system, that problem is erased and the fear of editing core templates should be as well. :) Unfortunately for me, all my styles rely on a custom "extra.css" template and moving all that code back to their respective templates is almost more work than it's worth, to me. I won't be relying on it as heavily moving forward on new styles, that's for sure.
 
The new merging system should drastically reduce these issues in custom styles. Template Modifications were designed for add-ons and it may even be detrimental to your styles if you write a search that XenForo itself changes at a later date. You won't get an outdated error making debugging for both you and the end users harder.
 
Just to make things clear: the template modification system is being moved to debug only in the next release (consistent with other similar features). It is primarily designed for add-on developers or for advanced usage (as it generally requires detailed knowledge of technical things or some inner workings of XF). For all "normal" usage, templates should be edited directly and updated with merging. This eliminates things like learning regular expressions or doing fragile exact match replacements. 3-way merging should be much more accurate. If you use modifications, you still need to be very methodical to ensure that your changes are still being applied the correct number of times and that the changes are still valid/correct.

If you prefer to use template modifications, obviously that's your prerogative but it's not the recommended/encouraged way.
 
If you prefer to use template modifications, obviously that's your prerogative but it's not the recommended/encouraged way.
May not be the recommended/encouraged way - but I just tried redoing numerous navigation edits I have set up into the main navigation template - and never could get all of them to work together well. Went back in and had the TM system re-enable them and they went back to working. For ME, it's much easier using the TM than going into one template and making 4 or 5 changes that aren't well documented for quick review (and I don't consider pulling out a piece of paper or up a document and then searching it "quick review"). With the TM, you can selectively enable/disable any modifications that you have made at any time without having to jack around with the main template, finding that one documented edit - removing it, then if wanting to put it in later having to recode it.
Personally, I think putting it into the debug screen is not the best choice - but I'm not coding the forum software and if forced to have to constantly have debug on the forum when making edits, I guess that's what I will have to do.
 
Just to make things clear: the template modification system is being moved to debug only in the next release (consistent with other similar features). It is primarily designed for add-on developers or for advanced usage (as it generally requires detailed knowledge of technical things or some inner workings of XF). For all "normal" usage, templates should be edited directly and updated with merging. This eliminates things like learning regular expressions or doing fragile exact match replacements. 3-way merging should be much more accurate. If you use modifications, you still need to be very methodical to ensure that your changes are still being applied the correct number of times and that the changes are still valid/correct.

If you prefer to use template modifications, obviously that's your prerogative but it's not the recommended/encouraged way.

You're probably right. But you can't really expect telling people to DO what they have always been told NOT TO DO to be an overnight sensation. Transitions take time and I will agree with Chris that this needs it's own HYS since it is a complete u-turn in the culture of running a forum.
 
Just to make things clear: the template modification system is being moved to debug only in the next release (consistent with other similar features). It is primarily designed for add-on developers or for advanced usage (as it generally requires detailed knowledge of technical things or some inner workings of XF). For all "normal" usage, templates should be edited directly and updated with merging. ...

If you prefer to use template modifications, obviously that's your prerogative but it's not the recommended/encouraged way.
This needs to be emphasized. Right now there's a bit of confusion about when to use TMs, when to just "modify templates", how the two are different, etc.
 
That was made explicitly clear from the start in the HYS thread.
XenForo 1.2 will deprecate the template hook system and introduce it's own template modification system to make it easier for add-on developers to change templates. Note that I'm primarily focused on add-on developers here. It is possible to create your own custom template modifications if you're not an add-on developer, but unless you have multiple styles, I'd recommend just making the changes to the templates directly.
 
I agree.

But no one seems to understand its significance. Too many people still find editing templates to be something they shouldn't do, and think they need the TM system for it.

I understand that... but IMHO there's something more:

I think that people (and me) prefer the TM's way because with TM you have all your template modifications listed with a title in one page and with a click you can enable/disable them (think about seasonal edits). Without using TM you have to manually list them, the list is out of the ACP, and to revert/modify a modification you need to find and read that list. If to make work a "new edit" you need to modify another edit you have to update your list... and people have a huge list of edits! :X3:

Ok, we have Evernote/Google Docs/SugarSync and many other services to store information in the cloud and have them in our pockets... but TM is too much convenient!! ;)

I think that the only thing that can make me stop to use the TM for little template edits is if in some way this use can break some addons... and I think that @Code Monkey think the same, right? ...or if with future upgrade will be possible to have a list of all the direct template edits made, a sort of a smart template edit history.
 
Top Bottom