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

Do I need to start with the default style?

Discussion in 'Styling and Customization Questions' started by Vicki, Mar 19, 2013.

  1. Vicki

    Vicki Active Member

    I've done a couple of styles on our testing site. Since I am not sure whether inheriting from Default Style would have any side effects later, so I've chosen NOT to pick a parent style, and I noticed it seemed always giving me the default style(before I make changes) anyway.

    Would that cause any problems when it comes to upgrades of the software? Before moving any further, I'd really like to get some ideas about the following questions:

    1) When creating a new style, what are the benefits and possible problems of using the default style as a parent style?

    2) What are the benefits and possible problems of creating new styles without a parent at all?

    Thanks anyone for sharing your insight about these!
  2. Chris D

    Chris D XenForo Developer Staff Member

    1) If you create a new style that has a parent, then most changes you make to the parent style will cascade down to the child style. I believe if you modify the child style though, it will break the inheritance and will no longer inherit new changes from the parent (someone please correct me if I'm wrong).

    2) If you create a style that doesn't have a parent then it will automatically create a new default XenForo style without a parent. There's no parent style, so there are no changes that it can inherit.
    Vicki and Russ like this.
  3. Russ

    Russ Well-Known Member

    I'll piggy off Chris's post and throw this in...

    Use a child style if you're making small changes, like on XF.com they have:

    Default Style parent; this style is normal fluid
    - Fixed Style - child of Default style; only one style property is changed (pageWidth Controller)
    - Kitchen Sink - child style of Default style; added in extra message bit properties

    For one of my styles I have the base style setup as the parent style, then all the child styles are used for different colors.

    Hope that helps a little.
    Vicki likes this.
  4. Arty

    Arty Well-Known Member

    Its impossible to create style without parent style. There is always a parent style: master style. Its not visible in styles list unless you have debug mode on.

    Style that you see in default installation called "default style" is actually an empty style.
    Vicki and RoldanLT like this.
  5. Vicki

    Vicki Active Member

    Thanks guys for the prompt responses!

    If the "default style" is actually an empty style, then does it mean that your new style will get to inherit from the master style anyway NO MATTER you specify the "default style" as the parent style or you don't specify a parent style at all?

    And if your new style(call it style2) had the master style as the parent, then when xenforo version 1.2's master style gets changed somewhat, your style2 created in previous version of xenforo will still inherit from the master style? How will the upgrades of xenforo version affects your new style?(sorry that I still don't quite get it even though I know Chris has been trying to explain about this, appreciated!)
  6. Arty

    Arty Well-Known Member



    It won't affect your style. Upgrade process simply replaces master style with new version.

    For child style it means only templates that weren't customized by that style will be updated. Customized templates must be updated by you.

    XF keeps track of version numbers when you customize template. If master style's version number of some template is higher than version number of same template in custom style, XF will warn you that your template is outdated. That's how you'll know what templates to update.

    To update it you can revert template and then repeat your changes. Or you can compare default template from old and new versions of XF (this might be tricky without external tools such as diff/filemerge/winmerge) and apply changes to your template.
    Vicki likes this.
  7. Vicki

    Vicki Active Member

    Thank you very much Arty for such thorough explanations!

    Now I'd need a little help in distinguishing the customized templates and the non-customized, please bear with me for my ignorance in all this.
    So far I've only used xenforo's Style Properties and Color Palette to generate the new style. The new style could be exported and imported pretty easily I found.
    Later on, I'll definitely need to add some customization in the extra.css for a few components that I found hard to customize via Style Properties and Color Palette.
    If I only do so much for the new style, does it mean all my templates are not customized by the new style? (I don't see any templates being marked red in Admin CP)

    If I do have individually edited template, when update time comes, how do I revert the template? There maybe some tools in Admin CP allow me revert the template to its latest version from xenforo? Then I repeat my needed changes from there?

    If I created a child style from that new style, and if I only did Style Properties and Color Palette edits and extra.css, then I don't need to update anything for this child style during upgrades, right? But if I did some individual template edits for the child style, then how do I update the edited template?
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Vicki likes this.
  9. James

    James Well-Known Member

    If you get confused regarding inheritance, it's kind of similar to the master slide functionality in PowerPoint... if you're familiar.
    Vicki likes this.
  10. Vicki

    Vicki Active Member

    Thanks James. But I am not familiar with the master slide functionality in PowerPoint...
  11. Vicki

    Vicki Active Member

    Say I have created a new style 'style2' using the master style as parent, and I edited a couple of templates in 'style2'. This new style will inherit from master style for sure that I know. But would a CHILD STYLE of 'style2' be able to inherit everything from 'style2' as well as from the master style?
  12. Brogan

    Brogan XenForo Moderator Staff Member

    Child styles inherit from the parent style(s).
  13. James

    James Well-Known Member

    -| Master Style
    --| Style2
    ---| Style2's beautiful child

    If you edit forum_list in Master Style, and none of the templates in style2 or style2's child have changed that template, they will inherit forum_list from Master Style.
    If any of the other templates have edited forum_list, they no longer inherit Master Style and instead use that edited template.

    If you edit Style2, provided the child doesn't have an edited version of that template, it will inherit everything from Style2.

    So, if the child is inheriting a template from style2, and style2 hasn't changed that template, technically it's all inherited from the master style.

    "But would a CHILD STYLE of 'style2' be able to inherit everything from 'style2' as well as from the master style?"
    All templates inherit from Master Style, unless any style in their own personal hierarchy has made a specific change to that template than that which is in Master Style. If it has, it inherits from that one.
    Vicki and Brogan like this.
  14. Vicki

    Vicki Active Member

    The theory you described is insanely clear:)...... Thanks James!

Share This Page