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

How do you keep track of template edits ?

Discussion in 'General XenForo Discussion and Feedback' started by avi, Feb 15, 2012.

  1. avi

    avi Active Member

    I am on older version of xF & I am about to upgrade it. But I think after upgrading I'd be losing all the template edits I have made.

    My question is, how do I find out the edits I have made easily ? Only solution that appears to me is, from ACP look at the templates which are colored in red. Tedious task o_O

    And also I like to know how you all keep track of edits ?
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Document them.

    Only templates marked as outdated will need to be reverted and re-edited.
  3. Floris

    Floris Guest

    Move your template edits into a product, as a plugin.
    That way you don't have to even think about upgrading.
  4. avi

    avi Active Member

    I didn't get this.

    Thanks, any tutorial to begin with ?
  5. Brogan

    Brogan XenForo Moderator Staff Member

    What are outdated templates and why do I need to revert them? Can't I just continue using the old ones?
    If a template is changed between releases, i.e. from 1.0.0 to 1.0.1, and you have manually edited it, then it will be marked as outdated. This is done because the software doesn't automatically overwrite those templates, thereby causing certain functionality which you have added to be lost. It is an indication that the core code has changed and you need to take action. The software will continue to function with these outdated templates but you may be missing important updates and bug fixes so it is recommended to revert and reapply any edits.

    How can I compare changed code when I have outdated templates which need to be reverted and edited once more?
    You can use a file compare program which will highlight any differences between two files. One such free program which runs in Windows is Notepad++.


    Not all templates are changed with each new release. Some are still the same as when the software was first released.
    Vilandra and avi like this.
  6. Floris

    Floris Guest

    It might be valid for all template edits, but quite a few things that people use the templates for can be injected using a custom template. Using a plugin you can have a listener.php file that does the hooking in.

    The benefit here is that you have a plugin you can turn on and off, can export and import, and could contain almost all of your template modifications without you having to ever edit those actual templates. I made a page_container edit once in version 1.0.0 and in 1.1.2 it's still working, and upgrading is just a matter of uploading files and running upgrade, as usual.

    For example; an admin wants to have a link on the profile page "send this user a private message", you could easily just edit the appropriate template. Or, check if there's a hook in that template for the position. Create a listener event in the back-end, and your own listener.php file. Then a custom template like mytemplate_profile_pm_button and put the code in there. Now when the profile page is loaded, through that hook, it injects the custom template. And you didn't edit the existing one. So when xenforo upgrades that template, no biggies, because as long as the hook is there your custom template code is injected.

    Additionally, most CSS changes in default templates can all be done in EXTRA.css, when I do is include my custom template into EXTRA.css so I can have a plugin with my own custom templates. If I need a backup of my custom code I just export my plugin - and I could even share it, import it on my other forum, and have all the changes again. Note: this is just extra work, by default extra.css by xenforo won't get upgraded because it's always empty. They understand customizations for css go in there (it's its purpose).

    The above example: http://xenfans.com/threads/profile-pc-button.1595/
    Benefits of a plugin for this: a) easy to maintain, b) doesn't touch original templates, c) custom phrases (and keeping them organized by having them in a plugin), d) options, so you can customize say it's position per board, e) easier to share with others

    You can use my plugin code to get an idea how to have a product, custom templates, phrases, file structure, and code, to achieve this. There are documentation thread on this web site here explaining the basics of a plugin.
    R_A and avi like this.
  7. avi

    avi Active Member

    Thank you both for the info.

    I will look into the code & try :D
  8. Adam Howard

    Adam Howard Well-Known Member

    Best way to compare and quickest way.

    Notebook ++ = http://notepad-plus-plus.org/
    Win merge = http://winmerge.org/

    Use these two and if there is even 1 space, letter, number, or symbol different.... This will tell you exactly what, what line, and where. (high lights them).
    Ingenious likes this.
  9. ragtek

    ragtek Guest

  10. Shelley

    Shelley Well-Known Member

    I'd probably just document the template changes. I see a lot of people making unneeded template edits when they can accomplish the same thing using css and putting the code in the extra.css significantly lowering the amount of edits they need to make. This might be a good time to glance back at the edits you've made and checking if any of those edits can be moved to the extra css template.

    I've dramatically lowered the edits I need to make by re-checking to the point it's more effort and takes more time to post a message than it does to upgrade my forum, and 3 other forums.
    Brett Peters likes this.
  11. Agent

    Agent Member

    I will have todo this also as my template is no longer surported by developer :(
  12. Talktemplate

    Talktemplate Member

    We just use a texted based change log. The key is to make it organized.
  13. Forsaken

    Forsaken Well-Known Member

    I use <xen:comment> tags with a brief description of what the edit is so I can remember it in my framework.
    Brett Peters likes this.
  14. Yoskaldyr

    Yoskaldyr Well-Known Member

    avi likes this.

Share This Page