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.

Template Questions /

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

Trouble with including ie7.css and ie6.css in page.ss


Go to End


3 Posts   2598 Views

Avatar
TotalNet

Community Member, 181 Posts

19 June 2009 at 12:15pm

Edited: 19/06/2009 2:34pm

So, the theory is that with a condition in your <head> section you can import a CSS file with overrides for IE6 and IE7.

Problem is, the CMS is generating the page with the standard <link rel="stylesheet" ... > tags after the <!-- [IF IE 7]> condition so the precedence is in the wrong order.

Am using SS2.3.1, with <% require themedCSS(layout) %> etc. above the conditional comment in page.ss in a custom theme.

I have tried commenting out Requirements::themedCSS("layout"); etc in page.php as well but the <link rel="stylesheet" ... > still only gets generated immediately before </head>

Same result if I set theme to blackcandy. I have made some changes to page.php but nothing that should cause this.

Only Solution is to remove Requirements::themedCSS("layout"); and <% require themedCSS(layout) %> from page.php and page.ss and hard-code the <link rel="stylesheet" type="text/css" href="http: ... /css/layout.css" /> etc.

Anyone else finding this or any ideas?

Cheers,

Rich

[edit]Have tested original version of page.php (as shipped with 2.3.1 stable build) with same results (after /dev/build)[/edit]

Avatar
Howard

Community Member, 215 Posts

19 June 2009 at 1:27pm

Yea that's an issue, I get around it by putting this in my Page.php

public function init() {
		parent::init();

		Requirements::themedCSS("layout"); 
		Requirements::themedCSS("typography"); 
		Requirements::themedCSS("form"); 
		$tags = '
			<!--[if lte IE 6]>
			<link rel="stylesheet" type="text/css" href="/themes/example/css/ie6.css" />
			<![endif]-->
			<!--[if IE 7]>
			<link rel="stylesheet" type="text/css" href="/themes/example/css/ie7.css" />
			<![endif]-->';
		Requirements::insertHeadTags($tags); 
	}

Not ideal but it does the trick :)

Avatar
TotalNet

Community Member, 181 Posts

19 June 2009 at 2:33pm

So it's not just me then, thanks.

I can't find a bug bug raised for this, has it been discussed before? I did search the forum prior to posting but hitting the right keywords isn't guaranteed.

Could someone testing 2.3.2rc check this out perhaps? I'm not really geared-up for beta testing right now and if it's not fixed in v2.3.2 then perhaps it should be.

Nice solution you've posted there but for now I'll stick to hard-coding the css into the template.

Cheers,

Rich