MDN

Go Back   Mambo - Forums Closed for posting > Mambo 3rd Party Addons > Templates

Reply
 
Thread Tools Search this Thread Display Modes
Old August 4th, 2005, 07:24   #1
toubkal
 
toubkal's Avatar
 
Join Date: Aug 2004
Location: Cheshire, England
Posts: 666
toubkal is on a distinguished road
Default Why do people not force IE into standards compliance?

Over recent months, I have been making more mambo templates and learning more and more about xhtml and css.

The biggest issue that I have come accross is cross browser compatability, and I have looked at endless discussions on various well known web design sites about box models and various hacks etc.

I have also learnt that if you specify the right doctype, you can force IE into standards compliance. This I attempted in vain with my mambo templates until I discovered that if the xml declaration appears before the doctype, good old IE will forget the doctype and go back into non compliant mode.

Ok so now I know that I can make my templates work as I want with IE and Firefox with no fuss using the doctype first. edit (leaving out the xml declaration - it is optional)

The Big question:
Why does nobody seem to do this with mambo templates ?

I have checked masses of them and it is very rare to find one that puts the doctype first and omits the optional xml declaration.

So what is the big downside to forcing IE to behave ?

My current read - XHTML & CSS - tells me to use it and does not mention issues. Can anyone shed some light on this for me please.

Thanks.

Last edited by toubkal : August 8th, 2005 at 11:05. Reason: clarify that the xml declaration should be ommitted if NOT first.
toubkal is offline   Reply With Quote
Old August 4th, 2005, 07:51   #2
hazman
 
hazman's Avatar
 
Join Date: Dec 2004
Location: Israel
Posts: 6,212
hazman is on a distinguished road
Default

Hi toubkal,

Can you please post an example here, this is very interesting.
__________________
All Open Source
http://www.xtremeopensource.org
hazman is offline   Reply With Quote
Old August 4th, 2005, 07:56   #3
toubkal
 
toubkal's Avatar
 
Join Date: Aug 2004
Location: Cheshire, England
Posts: 666
toubkal is on a distinguished road
Default well as you ask...

Okay so I am a wierd nerd for doing this but...

Yes I do have an example that I used for my own testing purposes.

EDIT: here is a link to the example online.
http://www.webxite.plus.com/xmlbefore.html

Copy the code below and view it in IE.

then move the xml declaration above the doc type and view it again.

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?xml version="1.0" encoding="iso-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Box Model Check</title>
</head>
<body>
<div style="margin-left: auto; margin-right: auto; color: #6734ee; border: dotted 2px #6734ee; width: 200px; padding: 40px; background: #ffeedd; height: 200px; overflow: auto;" >
<h1 style="color: #6734ee; border-bottom: dotted 2px #6734ee; text-align: center;">BW2</h1><h3 style="background-color: #6633FF; color: #FFFFFF; text-align: center; padding: 2px;border-bottom: solid 3px #ffffff">(Box Width Woes)</h3>Oh my Lord! I have finally worked out the whole box model nonsense. Using the w3 model, this box of width 200 and padding 40
 has a total box width of 280! Without the doctype declaration, IE would render it as 200 wide (with just 120 left in the centre for content!).
  Some difference huh.<br />
  Even more bizzarre, if after putting the correct doctype, you add the required
   xml declaration, where it should be, at the top of the document - IE jumps back to quirksmode !!!<br />
   Strangely, if the xml declaration comes <em>after</em> the doctype, all works fine!<br />
   <p>Well microsoft, you are a strange animal indeed. And so are those standards at times.</p>
</div>

</body>
</html>

Last edited by toubkal : August 4th, 2005 at 09:33. Reason: add link to example
toubkal is offline   Reply With Quote
Old August 4th, 2005, 08:22   #4
hazman
 
hazman's Avatar
 
Join Date: Dec 2004
Location: Israel
Posts: 6,212
hazman is on a distinguished road
Default

Hahahahaha you're not a wierd nerd for doing this, helpful is what you are.

Anyways I see what you mean. How do you have it in Mambo?
__________________
All Open Source
http://www.xtremeopensource.org
hazman is offline   Reply With Quote
Old August 4th, 2005, 08:29   #5
toubkal
 
toubkal's Avatar
 
Join Date: Aug 2004
Location: Cheshire, England
Posts: 666
toubkal is on a distinguished road
Default

well previously I did it as everyone else, with the xml declaration first, but my last template I put it second and I have swapped an older one to good effect. Everything works fine and renders closer to identical in the main browsers.

I just wonder if it breaks things for older browsers? As nobody else seems to do it this way, I am assuming that there is a good reason.

It just seems very odd to me that everyone is choosing the doctype to make IE behave in standards mode and then throwing the rule away by putting the xml first.

I hope someone can help on this as it looks fundemental to me.
toubkal is offline   Reply With Quote
Old August 4th, 2005, 08:38   #6
hazman
 
hazman's Avatar
 
Join Date: Dec 2004
Location: Israel
Posts: 6,212
hazman is on a distinguished road
Default

Quote:
Originally Posted by toubkal
It just seems very odd to me that everyone is choosing the doctype to make IE behave in standards mode and then throwing the rule away by putting the xml first.
Well...this doesn't make sense, does it.
__________________
All Open Source
http://www.xtremeopensource.org
hazman is offline   Reply With Quote
Old August 4th, 2005, 08:50   #7
thede
 
Join Date: Dec 2004
Posts: 2,572
thede is on a distinguished road
Default

I don't know the reason for the IE...
I believe the <? directives should be before the doctype... I may have read it somewhere I just couldn't find it... if you look at:
http://www.w3.org/TR/xhtml1/
you will see that they have the same order, searching for "xml version "1.0" doctype" will also bring up the same order always (at least all I found). As said, somehow I think the <?xml ... should be the first statement, but I cannot provide evidence now (I believe this is for the compatibility with the 1.0 XML version... putting it somewhere else is like removing it).
thede is offline   Reply With Quote
Old August 4th, 2005, 08:55   #8
toubkal
 
toubkal's Avatar
 
Join Date: Aug 2004
Location: Cheshire, England
Posts: 666
toubkal is on a distinguished road
Default

Yes I read that too. For proper complience with xhtml, the xml declaration SHOULD be first BUT it freaks IE back to stupid mode!!!

The book that I read says in this situation, ignore the web standard and put the doctype first to ensure IE behaves.

But no mambo sites do it ????
toubkal is offline   Reply With Quote
Old August 4th, 2005, 08:59   #9
thede
 
Join Date: Dec 2004
Posts: 2,572
thede is on a distinguished road
Default

In your case I would rather remove it because it is optional as far as I know, so removing it would be still compiliant (having it at the wrong position not... even though the XHTML validator seem not to care).

A reason to make IE behave not compiliant I could think of is the backward compatibility with older versions of IE which may still be around and which may not care so much about the DOCTYPE beeing first.

(Btw. just found a page where it says it must be the first if present: http://www.awprofessional.com/articl...&seqNum=3&rl=1 - I know a web page is no evidence... but an indication maybe)
thede is offline   Reply With Quote
Old August 4th, 2005, 09:28   #10
toubkal
 
toubkal's Avatar
 
Join Date: Aug 2004
Location: Cheshire, England
Posts: 666
toubkal is on a distinguished road
Default

Hi thede,

Thanks for that link. Certainly useful - as you say, it looks like it is better NOT to include the xml declaration if not in the correct place.

It would be good to have some facts about the problems of forcing the IE into compliance though.

For those interested, who want an easier look at the example - here is a link to the two versions:

http://www.webxite.plus.com/xmlbefore.html
toubkal is offline   Reply With Quote
Old August 4th, 2005, 09:36   #11
hazman
 
hazman's Avatar
 
Join Date: Dec 2004
Location: Israel
Posts: 6,212
hazman is on a distinguished road
Default

Yeah good link that one thede, thanx.

So, then it should go before the doctype?
__________________
All Open Source
http://www.xtremeopensource.org
hazman is offline   Reply With Quote
Old August 4th, 2005, 09:43   #12
toubkal
 
toubkal's Avatar
 
Join Date: Aug 2004
Location: Cheshire, England
Posts: 666
toubkal is on a distinguished road
Default

I just took another look at the book and it says:

Quote:
To ensure IE6 follows the standard rules set up in the W3C specifications - standards mode - simply leave out the XML declaration. Acording to the XML specifications, the XML declaration is optional, so don't use it.
Integrated HTML and CSS
toubkal is offline   Reply With Quote
Old August 4th, 2005, 09:49   #13
thede
 
Join Date: Dec 2004
Posts: 2,572
thede is on a distinguished road
Default

Quote:
Originally Posted by hazman
So, then it should go before the doctype?
Yes. My interpretation of the reasoning is... that it helps a XML-parser to know that this is a XML-file and what kind of. The doctype is often not important for non-validating XML-parsers. It may also be the case that the "<?xml ..." influences how all of the following code - including the doctype - should be interpreted (for example the encoding).
thede is offline   Reply With Quote
Old August 4th, 2005, 10:06   #14
toubkal
 
toubkal's Avatar
 
Join Date: Aug 2004
Location: Cheshire, England
Posts: 666
toubkal is on a distinguished road
Default

Sites where you expect good code like:

Html Dog
A list apart
Left justified

and countless others do not use the XML declaration, but DO use the doctype first, so why does mambo need it?
toubkal is offline   Reply With Quote
Old August 8th, 2005, 13:05   #15
toubkal
 
toubkal's Avatar
 
Join Date: Aug 2004
Location: Cheshire, England
Posts: 666
toubkal is on a distinguished road
Default

Sorry for the poor examples posted earlier.

I just took a look at them and noticed that in my haste to put up the examples, 1 of the files had not transferred completely to the server and was only about three quarters of the file! It just goes to show how forgiving browsers can be - the bottom part of the document missing and it still worked!

I expect some looking at this post would have thought it was just my hopeless coding causing the difference.

I have re-uploaded the files now and checked them for valid code.

They still demonstrate the same issue (just better quality example ).
Render exactly the same in firefox and vastly different in IE.

I would still appreciate any firm information on this issue as it greatly influences the coding of templates.

Thanks
toubkal is offline   Reply With Quote
Old August 8th, 2005, 13:10   #16
jifor
 
jifor's Avatar
 
Join Date: Apr 2004
Posts: 710
jifor is on a distinguished road
Default

I completely agree that we should be using standards mode. In fact I wrote an article about it: http://www.sunspotinteractive.com/notebook.html

I'm not a great writer, but you should get the point and there are some neat resources quoted.

Cheers,

David
jifor is offline   Reply With Quote
Old August 8th, 2005, 13:27   #17
toubkal
 
toubkal's Avatar
 
Join Date: Aug 2004
Location: Cheshire, England
Posts: 666
toubkal is on a distinguished road
Default

Thanks for that jifor - you have certainly explained it with more authority that I have. I was beginning to think that I was alone in this. When I realised that the xml declaration was preventing compliance I thought it was a huge breakthrough for my designs - until I looked at stacks of mambo sites and assumed there was good reason for not using it.

People often talk about ensuring that their sites are backwardly compatable, but to me if you force quirksmode it is just backwards - not compatable.

I keep hearing people talking about the arrival of IE7 (a long way off) and yet nobody seems to be using IE6 yet!!
toubkal is offline   Reply With Quote
Old August 8th, 2005, 13:40   #18
jifor
 
jifor's Avatar
 
Join Date: Apr 2004
Posts: 710
jifor is on a distinguished road
Default

My stats indicate that it is not worth my while to cater to IE5 or older and even if they did indicate a significant number of users cruising my site were using older browsers, I'm not going to hold back progressive and standards compliant design for their sake. Time to move forward, people.

If my site offered geriatric services or similar, I would think about it.

You might be interested in this article. Beware, the water is deep: http://www.mikeindustries.com/blog/a...wser-evolution

Cheers,

David
jifor is offline   Reply With Quote
Old August 8th, 2005, 19:50   #19
absalom
 
Posts: n/a
Default

The template tutorial I wrote specifically deals with the XML nuance of IE, where I basically suggested people drop the XML call before the doctype.

All the templates I release and develop are now designed this way. I'm still updating the legacy code I have to work this way as well.

Last edited by absalom : August 8th, 2005 at 23:23.
  Reply With Quote
Old August 8th, 2005, 19:53   #20
absalom
 
Posts: n/a
Default

Quote:
Originally Posted by jifor
My stats indicate that it is not worth my while to cater to IE5 or older and even if they did indicate a significant number of users cruising my site were using older browsers, I'm not going to hold back progressive and standards compliant design for their sake. Time to move forward, people.

If my site offered geriatric services or similar, I would think about it.

You might be interested in this article. Beware, the water is deep: http://www.mikeindustries.com/blog/a...wser-evolution

Cheers,

David
Yeah, well, currently on my own site, IE6 sits at 50% of overall hits per month (45% from the Fox), and on a fairly "consumer" centric site I run, the Fox is already past 10%, with IE hovering around 80% at the moment.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox or IE-Maxthon lukitar General Questions 56 August 8th, 2005 07:41
Development Standards and Guidelines grutkowski 5.0 33 June 6th, 2005 21:14


All times are GMT -7. The time now is 08:12.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.