Code Generator & an interesting problem with IE6

2 posts by 2 authors in: Forums > CMS Builder
Last Post: May 31, 2008   (RSS)

By Mel - May 31, 2008

Hi Dave,

Had an interesting hour or so today trying to track a problem down in IE6

All layout in Firefox using auto margins worked just fine as usual but forgot to check in IE6 but when I did everything was to the left of the screen ooops

Looked back at a couple of my old sites that had not used CMS but had used wrappers with auto margins to see if I had made a mistake - nothing obvious there

But the only real difference between the old sites and the one I am working on is the code generator in CMS and in particular this bit below that code generator produced

<?php echo "<?xml version='1.0'?>\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

As soon as you take out the echo statement normal service is resumed - all wrappers neatly in the center of the page where they are supposed to be

As for the data all seems to be displaying as I want it to

So - are there any potential problems in leaving the echo statement out and from an interest point of view what does it do?

Thanks Mel

Re: [mel] Code Generator & an interesting problem with IE6

By Dave - May 31, 2008

Hi Mel,

I think you're totally fine to just remove that line if it's causing problems. Actually the only code you need from the code generator is the Step1, Step2, etc code, and something a meta charset tag.

The echo statement just prints this: <?xml version='1.0'?>
Which encouraged but not required by the W3C for well formed XHTML documents. Search http://www.w3.org/TR/xhtml1/ for "xml version".

The reason why it's in a PHP tag is some installs of PHP are configured to run php code in tags like this <? echo "hello" ?> and so when they see <?xml version='1.0'?> they run it as PHP code and generate an error. So we put it inside a PHP tag to guarantee it won't generate an error.

I haven't heard of that affecting how browsers render the page though. Usually whether or not you have the <!DOCTYPE ... > tag will put the browser in a different render mode (called "quirks mode") or not which will affect that. But other than that I'm not sure.

In any case, all that extra code is optional so you're safe to remove it. Let me know if there's anything else I can do to help! :)
Dave Edis - Senior Developer
interactivetools.com