XF 2.2 Better to make all changes in one template modification or make them to separate modifications?

securedme

Active member
For example I have some modifications to the template PAGE_CONTAINER. Is it better to change the file once or make the changes bit by bit in several modifications?

1701151087859.webp
 
Solution
I mean currently if I make 10 mods, say, to one particular template, sometimes I'll have to re-order them because they're maybe some other mods made by other add-ons.

So now, if I make all those 10 mods in a single mod (basically rewrite the template). Would it still work with other mods by those add-ons?
If you put them all in one modification then you can only put one order of execution. If one part of your template needs changing due to an addon modifying it also then it may mess up the order and you may have to strip bits back out of it to execute them later than other modifications in the template to compensate for addons modifying the same template. If that makes sense.
One more thing. Does it still work if there are other add-ons that make changes to the same template that I'm going to make all of my own modifications in the same mod?
 
One more thing. Does it still work if there are other add-ons that make changes to the same template that I'm going to make all of my own modifications in the same mod?
I'm not entirely sure what you mean but order of execution is important if the same section of a template is being modified multiple times.
 
I'm not entirely sure what you mean but order of execution is important if the same section of a template is being modified multiple times.

I mean currently if I make 10 mods, say, to one particular template, sometimes I'll have to re-order them because they're maybe some other mods made by other add-ons.

So now, if I make all those 10 mods in a single mod (basically rewrite the template). Would it still work with other mods by those add-ons?
 
Again, it depends on order of execution and whether the earlier changes affect the template so the later changes aren't applied.

The find component of the TM is crucial in that respect.
 
I mean currently if I make 10 mods, say, to one particular template, sometimes I'll have to re-order them because they're maybe some other mods made by other add-ons.

So now, if I make all those 10 mods in a single mod (basically rewrite the template). Would it still work with other mods by those add-ons?
If you put them all in one modification then you can only put one order of execution. If one part of your template needs changing due to an addon modifying it also then it may mess up the order and you may have to strip bits back out of it to execute them later than other modifications in the template to compensate for addons modifying the same template. If that makes sense.
 
Solution
If you put them all in one modification then you can only put one order of execution. If one part of your template needs changing due to an addon modifying it also then it may mess up the order and you may have to strip bits back out of it to execute them later than other modifications in the template to compensate for addons modifying the same template. If that makes sense.

So it's not really a good idea or usual practice to put all changes in one modification unless I'm the only one who make changes to such template, right?
 
So it's not really a good idea or usual practice to put all changes in one modification unless I'm the only one who make changes to such template, right?
I would agree. The more modifications you have in one template the more likely you are to run into trouble with other addons and modifications that need to run earlier/later than your own. There's no performance benefit to either as Paul mentioned so it's better to just keep them smaller (or at least grouped into common areas) so that you can debug anything going wrong and/or compensate for other modifications.
 
FWIW, I have some fairly complex template modifications that I've decided to take the route of splitting them into multiple modifications that are individually simpler. When you have a regex that is making 20 changes, and then a XenForo template changes enough to break the regex, none of the 20 changes get applied and it's also tougher figuring out where it even broke.

So purely for ease of future work, splitting that into 20 simple template modifications is less long-term work. You can see easily if one doesn't work so it's much easier to debug.
 
Top Bottom