This is a very interesting topic. I also found the tutorial on Joomlaya (http://www.joomlaya.com/content/view/221/83/
) and I immediately checked the declaration in my own template and found a line before the doctype declaration:
Moving this piece of code completely ruins my page layout. So I left it there.
Geraint posted the following link to a message in IEBlog:
But there was an interesting answer to this post: http://blogs.msdn.com/ie/archive/2005/07/29/445242.aspx#446507
. So it seems that it doesn't really matter if the doctype declaration is not the first line in the code.
What is the conclusion? Should the doctype declaration be the first line? If so, what should happen to the XML declaration of the index.php template to avoid it from ruining the design??
There are actually 4 seperate code sequences inside the above code:
The 'access or die' statement, to secure the template:
defined( "_VALID_MOS" ) or die( "Direct Access to this location is not allowed." );
The ISO language call:
$iso = split( '=', _ISO );
The XML prolog call:
echo '<?xml version="1.0" encoding="'. $iso .'"?' .'>';
and the Doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
What you need to do to force IE to conform to standards is remove the XML prolog call, and since the ISO call is dependent on the XML prolog, you may as well remove that too!
It's entirely understandable that removing the entire first line combination ('access or die, ISO and XML prolog') will cause your template to not work. As for the rest of your questions, it's better to leave the 'access or die' statement as the first line as it secures all of your template. You then follow that statement with the doctype, at which point IE renders in standards compliance mode.
Design with integrity : Web accessible solutionshttp://www.absalom.bizhttp://twitter.com/absalomedia