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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Change order of applied CSS.


Go to End


3 Posts   2499 Views

Avatar
MKayHavoc

Community Member, 33 Posts

4 June 2008 at 10:16pm

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

Community Member, 11 Posts

5 June 2008 at 10:16pm

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

Forum Moderator, 5523 Posts

5 June 2008 at 11:19pm

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