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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

XHTML Doctype removed in IE

Go to End

2 Posts   1398 Views


Community Member, 1 Post

5 February 2011 at 12:12am

In IE the XHTML DocType I have is replaced by the standard HTML 4 Doctype, causing the site to look radically different.
I've tried setting ContentNegiotator off in both the page's php file and _config and have the <?xml before the DOCTYPE but it is still being replaced.

How can I set it so that the DOCTYPE is left as it is in the .ss file?


Community Member, 344 Posts

12 February 2011 at 5:08am

Edited: 12/02/2011 5:26am

Re: How can I set it so that the DOCTYPE is left as it is in the .ss file?

IE expects that the *first* line is the Doctype. You have probably the "<?xml version="1.0" encoding="UTF-8"?>" tag there.
This tag is unnecessary if you make sure the server delivers utf-8 per default.
You can do that via php:

header("Content-Type: text/html; charset=utf-8");

...or .htaccess:
AddDefaultCharset utf-8

... or html:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

Edit: Silverstripe already sends a proper utf-8 content-type per default. So just delete the "<?xml version="1.0" encoding="UTF-8"?>" tag or whatever you have there in the first line and IE will stop replacing the doctype.