Sometime back I learned to set my doc type in TYPO3 by using TypoScript code like this:
config.doctype = xhtml_trans
This tells TYPO3 how to render content and what to set in the final HTML for the Document Type Declaration.
However, I had to stop using that method because it would insert an xml declaration (prologue) in front of the doctype. The prologue looks like this:
<?xml version="1.0" encoding="iso-8859-1"?>
Technically, it is correct to include this line. However, if it is included, Internet Explorer 6 will render in quirks mode instead of standards mode. Because of this and since other browsers do not require it, it is common practice to leave out this prologue. Since this is what I wanted to do, I had to abandon the method I mentioned earlier and started using the following code to set my doc type:
config.doctype (
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
)
It is too bad that when learning about doctype I had not read the TSref a little further for the answer to my situation was just a little lower on the page in the property xmlprologue. This is the code I now use:
config {
doctype = xhtml_trans
xmlprologue = none
}
Basically, the following code will tell TYPO3 to render XHTML and provide a Document Type Declaration of XHTML Transitional without including an xml prologue. It also adds the correct xml namespace attribute to the HTML tag.
The doctypeSwitch, xhtml_cleaning and htmlTag_setParams properties (detailed in TSRef) can be of use as well (but I will let you look them up yourself to see if they are something you might want to use).
Since including the prologue is best practise, of course some developers of TYPO3 have handled this. Do the following in your template:
config {
doctype = xhtml_trans
xhtml_cleaning = all
htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml" xml:lang="da"
}
[browser = msie] && [version=