XF 1.2 Template Modifications and Comparison

Anyone who has developed add-ons for XenForo 1.1 knows that template hooks are a pain. They're a pain for us too, to say the least. Plenty of people have installed the Template Modification System add-on. We've been planning a TMS-like system for some time, before the XenForo add-on was ever actually released.

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.

Let's look at what a template modification is:

ss-2013-04-12_11-35-58.webp


It's simply a "find this" and "replace with that" style replacement. You can do this to any template. If your find matches multiple times in a single template, it will replace each occurrence.

Applying a template modification does not actually modify the template, so it will not show up as customized and it will be automatically reapplied (if possible) when upgrading.

For those of you that want technical details, the modifications are applied before a template is parsed. If the modifications cause a template compilation error, they are automatically disabled.

Here's what the template modification overview looks like:

ss-2013-04-12_11-41-07.webp


All of the template modifications will be listed here, grouped by add-on and ordered by template. The checkbox enables/disables the modification. Note that if the modification is part of an add-on (and you're not in debug mode), you will not be able to edit the modification here but you can enable/disable it. More about this when editing a template.

The 3 numbers indicate the number of times the modification matched (green), the number of times the modification failed to match (grey) and the number of times the modification caused an error (red).

Editing a Template
There are a few new bits when editing a template as well.

ss-2013-04-12_11-43-10.webp


There are 3 new things here:
  • The "prevent" checkbox. If selected, modifications will be never be applied to this template. This can be used to quickly check a template without modifications or to adjust the modifications manually.
  • The "view template modifications" link. I'll discuss this below.
  • The "view custom changes" link. This will simply display a comparison of the parent version of the template (probably the master version) and the current version so you can identify the differences.
When you select view template modifications, you'll see an overlay like this:
ss-2013-04-12_11-43-25.webp

This shows you a comparison of how the template modifications will be applied to this template.
If you choose to manually apply modifications, the template modifications will be "materialized" into the template - they will actually be written into the template and automatic application of modifications will be disabled in this template. You can then manually edit the modifications if you wish. (Obviously if you upgrade an add-on and they've changed their modifications or you install a new add-on that changes this template, you won't be getting those new modifications so this should be used with care.)

Admin and Email Templates
These aren't left out. Add-on developers will have access to very similar systems that allow the admin and email templates to be manipulated in the same way.
We look forward to more dynamic add-ons with XenForo 1.2. :)
 
Last edited by a moderator:
TMS is a pain in the ass with a framework unless it's made with TMS.
TMS has been created to match XenForo default system. This will be certainly the same for the future official system. You might need to rethink your framework once the official system has been released.
 
TMS has been created to match XenForo default system. This will be certainly the same for the future official system. You might need to rethink your framework once the official system has been released.
There is no issue with XenForo, only when TMS is installed.

So no, it isn't an issue with the style :).
 
TMS is more flexible than a framework. Frameworks are better for people that are not familiar with HTML and CSS imo. It provides them with an easy to use interface to edit templates. For experienced people frameworks can sometimes be a pain :)
 
TMS is more flexible than a framework. Frameworks are better for people that are not familiar with HTML and CSS imo. It provides them with an easy to use interface to edit templates. For experienced people frameworks can sometimes be a pain :)
Uh... Not really? You've no experience with my framework, and I don't know about Johns.

With my framework I've been able to do every style I've created with less than 100 declarations in our xenique_custom.css template.

Without it you'd be looking at ~1000 or more, and most of that is just the navigation, node or message templates.

My framework also adds additional functionality so that things can be done easier and allow you to insert things like WebFonts with minimal effort (As easy as activating two switches, inserting provider and the font or uploading the cufon file and inserting the name).

As far as being a pain to use... I've named and organized my framework so that it is easy for people to understand. Navigation style properties are split into 3 groups (Containers, Tabs and Corners) and other large sections are split into a minimum of two for better organization.

Most of my customers only find it initially confusing and afterwards they're pretty much able to do what they need themselves for customization (With exceptions to a few things like Octanes navigation which I usually do for them).

TMS might be more flexible, but it would be more work for the average forum admin who do not understand CSS or HTML.
 
I am not familiar with your framework. I was talking about XenForo's default style framework. But my opinion stands, frameworks can sometimes be a pain. Not always, but sometimes. With direct CSS I can make something like "div.class:first-child li.class:last-child a:nth-child(2n)" in an instant. Now tell me how to do it with a framework :) Plus, with direct css you don't have to look for the right style property first. Just open the extra.css or whatever template you want to edit, paste your code and that's it. It's quick and saves time :)
 
I am not familiar with your framework. I was talking about XenForo's default style framework. But my opinion stands, frameworks can sometimes be a pain. Not always, but sometimes. With direct CSS I can make something like "div.class:first-child li.class:last-child a:nth-child(2n)" in an instant. Now tell me how to do it with a framework :) Plus, with direct css you don't have to look for the right style property first. Just open the extra.css or whatever template you want to edit, paste your code and that's it. It's quick and saves time :)
Yes, you could do that in an instant. If you're familiar with XenForo and its classes, proficient with CSS and are able to do everything from memory.

However at most only 5% of administrators fit that criteria and that's being generous. Most average admins don't understand HTML, much less advanced CSS psuedo-classes.

Obviously writing code into extra.css is more flexible in what you can do. It is also more time consuming to do so for every single style, and is not friendly for admins that buy pre-made styles.

If 100 people buy my style, there are 100 different things they will want to do with my style. Creating a flexible framework that allows them to do nearly everything they would want is much easier than having to help them write out the CSS and help them understand it so they can make changes.

I've included a few screenshots of major areas that get changed in styles that commonly need to have CSS coded directly. I can do all this in a matter of seconds with my framework and not have to worry about it.

EDIT: Forgot to say, Se7enSins, AdeptGamer (new style and old style), TruckMoutnForums, Tapatalk, 311 and other styles I have done are all on this framework and they're all able to do changes they need with minimal help from me (I mostly just do the updates as it requires updating the framework more often than not).

Without any familiarity about a subject you really should not be making such broad unfounded statements.
 

Attachments

  • Categories.webp
    Categories.webp
    51.4 KB · Views: 71
  • Discussion-List.webp
    Discussion-List.webp
    32.4 KB · Views: 2,937
  • Message-List.webp
    Message-List.webp
    48.6 KB · Views: 63
  • Navigation-Tabs.webp
    Navigation-Tabs.webp
    31.2 KB · Views: 63
  • Node-List.webp
    Node-List.webp
    48.9 KB · Views: 59
Yeah, I believe your framework is awesome for a lot of admins. And I'm sure it is awesome for experienced admins as well, heck, I believe it is awesome for all admins. :) But there are times you just want to make a quick edit and you don't want to go through style properties to do it. Basically my point was, nothing is perfect. Everything has a negative side. Editing CSS directly and TMS are no exceptions :)
 
Can you have nested template modifications? For instance, if an add-on is pretty "heavy", it might have nested templates and a user of the add-on might have wanted to make changes to the templates of the add-on. It would be very cool, if an add-on upgrade would go through the same process an XF upgrade goes through, so modified/ add-on templates and the modifications of those templates don't break the add-on, when it is upgraded. So basically, will this TM system be valid and work for add-ons too, so their upgrade process isn't borked by changed templates?

Scott
 
Is this feature working in 1.2 Beta 1? I don't seen an option for TMC anywhere and when I click on "Prevent template modifications from being automatically applied" I get "Route template-modifications/ could not be found." Am I missing something here?

Thanks!
 
Top Bottom