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

Template management?

Discussion in 'XenForo Development Discussions' started by Cheesegrits, Oct 7, 2010.

  1. Cheesegrits

    Cheesegrits Active Member

    I haven't even started delving that into the template system in XF yet, beyond some cursory exploration, but I'm slightly worried as I'm already seeing mods being posted with manual template edit instructions.

    I really don't want to see XF suffer from the same horrible templateitis that plagued vB, so I'm hoping there already is, or will be, a formal template modification system, template hooks and whatever else we need to avoid repeating history.

    Can anyone enlighten me as to the "official" way for mods to handle template modifications?

    -- hugh
  2. RickM

    RickM Well-Known Member


    There are a number of things (modding wise) that have been posted that need sorting out before 'gold'. It's all well and good making the system 'moddable' (Which it is VERY!) however the delivery of those mods needs improving. I'm guessing its on the way but wasn't ready for the BETA :)
  3. Cheesegrits

    Cheesegrits Active Member

    Personally what I'd like to see is a 'Template Modification Arbitration Service' built in to XF, with all template mods being handled at runtime rather than install time. The mod would register with TMAS, tell it it the templates it wants to modify and the changes it wants. The ACP should feature a TMAS section, where the admin can set an execution order, and tweak the edits to accommodate any modification clashes (where mod A makes mod B non-matchable).

    -- hugh
  4. ragtek

    ragtek Guest

    Pls not at runtime! Changing the Template at the add-on installation is much more better for the performance and you don't have unnecessary overhead for replace operations!

    vBulletin have a great Add-on for this => TMS (Template Modification System)
  5. Cheesegrits

    Cheesegrits Active Member

    Yes, I'm familiar with TMS.

    As I said, I haven't looked that hard at XF's template system, but my understanding is it compiles templates. So it should be possible to have an efficient runtime system, that only recompiles templates when changes have been made to any dependencies.

    However it gets done, I just want to see it ASAP as a part of the core of XF, and some clear guidelines put out for coders. I still have nightmares about vB templates and system upgrades.

    -- hugh
  6. hcmagix

    hcmagix Active Member

    thats will be cool for xF. What Andreas said, will he ported TMS to xF? ;)
  7. Cheesegrits

    Cheesegrits Active Member

    Well, kinda of my whole point is, I'm hoping it won't be left to the mod community to provide a TMS which people may or may not use. It needs to be a non-optional part of XF's core!

    -- hugh
    Dietmar likes this.
  8. Lawrence

    Lawrence Well-Known Member

    Template Hooks are planned, :)

    In the mean time if edits are required try to limit it to one line using <xen:include....> which adds in your template to the one that would require edits. Depending on the amount of edits, you may also want to consider having your method override the function that loads one specific template, with your own version (if possible).
    CyberAP and bambua like this.
  9. Cheesegrits

    Cheesegrits Active Member

    Thanks for the response, Lawrence.

    Template hooks are great and all, and I'm all in favor of a liberal sprinkling of well thought out hooks, which obviously greatly reduces the need for template editing in the first place.

    But I still strongly feel there is a need for some kind of TMS as part of the XF core. This being the real world, there will always be mods that need greater modifications than simple hooks can provide. And even if Andreas or someone else implements a third party TMS, not everyone will use it.

    I'd like to see a policy of "We don't need no steekin' manual template edits" from (as close to possible) Day One, and a formal, supported, core method for doing it programmatically, in an update friendly way. I just don't want to come to dread XF upgrades as much as I do vB upgrades, due to the tedious hours of re-applying template mods by hand.

    Just FYI, my first experience with a TMS was as the co-author of vBlogetin, where we built an automagic template editor, which used a simple instruction set and versioned XML update sets, to make our edits a push-button deal when installing or updating the product. After vBlogetin got killed off, I started rebuilding our TMS system for general use, but (thankfully!) Andreas beat me to it, and I switched to using his TMS for all my subsequent vB work.

    -- hugh
    Yoskaldyr and ragtek like this.
  10. Yoskaldyr

    Yoskaldyr Well-Known Member

  11. SchmitzIT

    SchmitzIT Well-Known Member

    But sometimes you need to do more work than that. I extensively use TMS in order to accomplish a few things:

    1) Changing of the standard templates supplied to vB. This can be a simple operation like switching the order of two lines of template code, or something complex like complete customization of the postbit template.

    2) Retaining these edits as much as possible when upgrading my forums. If I had to manually re-apply all the edits every single time I upgraded my forum to a new version, I'd have headbutted a train a long time ago. TMS simply adds the edits every single time, and the only thing I have to ensure is that whatever specific lines of template code I selected to be used as a hook are still in place.

    This basically allows me to greatly simplify editing work. My forum is heavily customized, with various tweaks, and yet, I think that the amount of specific TMS rules I set up is less than 20. I have full control over how the edits are performed, and if XF would offer something similar to this out of the box, I'd be an extremely happy admin :)
    gldtn, ankurs, Nolik and 3 others like this.
  12. Yoskaldyr

    Yoskaldyr Well-Known Member


Share This Page