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

Master Style

Discussion in 'XenForo Questions and Support' started by Peggy, Mar 6, 2011.

  1. Peggy

    Peggy Well-Known Member

    Probably already been asked, but I can't find it.

    How do you create a "master style"?
    Would this be the style where you note all of the edits to your customized style so that you can reapply them?

    Never having done this, I'm rather confused.
     
  2. Kier

    Kier XenForo Developer Staff Member

    The Master Style (style_id = 0) is the uneditable master copy that gets updated by developers. It's not intended to be manipulated by administrators. It's always there, but normally it's hidden unless you're running in debug mode.

    Note that any changes made to the master style will be instantly wiped out as soon as you run a XenForo upgrade script.
     
  3. Peggy

    Peggy Well-Known Member

    ahha so this is something that I don't need (or want) to do, not being a developer, right?
     
  4. Kier

    Kier XenForo Developer Staff Member

    You want to leave it well alone [​IMG]
     
    Peggy likes this.
  5. George

    George Active Member

    I updated another theme and that wiped out my templates as well. I used the overwrite option. These were totally new templates that didn't go with the theme. How should we save our templates?

    Luckily it was only three templates and I can redo them fairly easy. Trying to get the hang of this while building the new forums.

    Edit: Plus when I make mods I put them in the master style. What should I do with them. I know in vB we had to install mod templates in the master style of they would not be included in the export.
     
  6. Kier

    Kier XenForo Developer Staff Member

    There are two questions to answer here:

    1) Save your template customizations in non-master styles.

    2) Add-ons should add their templates to the master style but they must use an add-on ID that is not XenForo, or they will be overwritten by the XenForo upgrade process.
     
  7. George

    George Active Member

    Thanks for the quick reply.

    One last question. Any idea why the templates I made were removed when I updated my style from the RC2 to the RC3 version of the style?
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I assume the missing templates were part of the master style and got overwritten by the upgrade process. Or you overwrote the style containing those templates when importing the new style:

    Admin CP -> Appearance -> Import a Style -> Overwrite style
     
  9. George

    George Active Member

    Well that is how you upgrade a style sure. I didn't think it would remove/overwrite any templates that did not have the same name. So if I use a style from here and make custom templates for pages for my site, Then upgrade said style and it removes the custom templates. So every upgrade I have to recreate the templates. Thats a pain in the you know what.
    The software should leave any extra templates that have nothing to do with the software alone. It should not remove then for every upgrade.
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It's an overwrite, not a merge.

    For your situation you can use parent / child styles to separate your custom templates from the main style. For example, if you create a new style to contain your custom templates and then upload the custom style as a child of that style, then the custom style will inherit all of the custom templates from the parent. And those custom templates would not get overwritten when you overwrite the custom style with a newer version of itself because they are contained in the parent style which is separate.
     
  11. George

    George Active Member

    But if the new templates have nothing to do with any style they should get left alone no matter what. I shouldn't have to rebuild my site for every upgrade. I shouldn't have to create a new style for every upgrade. By 2012 my template id would be 50. As of now my template id would be somewhere around 9. Thus why I always overwrite. I have three styles the Master Style, The Default style(Not selectable), Then the site I use for the site. So your saying I should make yet another style as a child style? Then I would have to keep two styles updated for every upgrade. No thanks!!!

    When I build my site I build it inside of xenForo template system to make using the css much easier. I can not put my custom templates in the master style cause they get removed. I can put them in a style downloaded from here cause they get removed on style upgrades. So where do i put them?
     
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That might be a good feature suggestion... allowing style merges. But right now the system only supports overwriting an existing style, not merging with it.

    You don't have to. You can avoid the problem of losing your custom templates by using parent / child styles.

    Just one new style which will be a parent to your custom style. The parent will contain your custom templates. This does not cause more work later. It actually reduces the amount of work because no longer will you lose your custom templates when you update your custom style.

    Don't put your custom templates in the master style. Create a new style and use it as a parent to your custom style.
     
    Steve F likes this.

Share This Page