Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

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

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

Change order of applied CSS.


Reply

3 Posts   1779 Views

Avatar
MKayHavoc

4 June 2008 at 10:16pm Community Member, 33 Posts

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.

Avatar
KingBerT

5 June 2008 at 10:16pm Community Member, 11 Posts

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.

Avatar
Willr

5 June 2008 at 11:19pm Forum Moderator, 5511 Posts

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