Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Change order of applied CSS.

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1714 Views
  • MKayHavoc
    Avatar
    Community Member
    33 Posts

    Change order of applied CSS. Link to this post

    Hi,

    How can I change the order of my css files?

    at the minute it's:

    <!--[if IE 6]>
       <style type="text/css">
        @import url(themes/staff/css/ie6.css);
       </style>
    <![endif]-->
          
    <!--[if IE 7]>
       <style type="text/css">
       @import url(themes/staff/css/ie7.css);
       </style>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="themes/staff/css/layout.css" />
    <link rel="stylesheet" type="text/css" href="themes/staff/css/typography.css" />
    <link rel="stylesheet" type="text/css" href="themes/staff/css/form.css" />

    When it should be:

    typography.css
    form.css
    layout.css
    ie7
    ie6

    I can't see were to change it in the templates.

  • KingBerT
    Avatar
    Community Member
    11 Posts

    Re: Change order of applied CSS. Link to this post

    Hello,
    look into your code folder!
    Then open Page.php
    There you'll find smth like:

    class Page_Controller extends ContentController {
       function init() {
          parent::init();
          
          Requirements::themedCSS("layout");
          Requirements::themedCSS("typography");
          Requirements::themedCSS("form");
    }
    ....


    Here you can change the order, or remove those commands and write it direct to the head element.

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: Change order of applied CSS. Link to this post

    As KingBert pointed out some on the CSS files are loaded dynamically from the PHP where as the IE conditional comment files are loading from the template. Requirements() the method you call to add css files automagically inserts the links at the end of the <head> section. Someone in the forum has come up with a script to include ie stylessheets from the PHP - see http://www.silverstripe.com/site-builders-forum/flat/58061#post60072

    1714 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.