Is there a reason the back-end PHP code could affect the layout of a page? This only happens in IE. In Firefox and Chro开发者_如何学JAVAme, everything looks fine.
Thing is, we have this HTML code, then a back-end code for the functions on that page is inserted by <?php include "[name of file]";?>
. The php file we included has no styling in it whatsoever but it mysteriously makes the whole page go to the left edge (instead of centered). If we remove that file from the page, it renders normally.
We have learned that if we comment out a certain part of the code on that file (view below), the layout gets fixed:
//function position_list() {
global $db, $core, $global;
ob_start('ob_gzhandler');
include ROOT.'templates/listing.php';
ob_flush();
//}
I'm just wondering if anybody has encountered a similar problem? What could be wrong?
There is probably a problem with the included code, not with styles but with broken tags. Some nesting is going on and a tag is being closed by something other than what opened it or something is being left open. You should try running the output code through a strict html validator to find the error.
Compare the source in IE with and without the include line. Is it what you expect? Are there any PHP warnings?
Quite odd to see you comment out the function {}
part without commenting out the body of the function. You're effectively now calling position_list();
whatever. Which of the lines is it that is causing the rendering to change?
If this is all before the doctyle and <html>
tag then it could be that the output is triggering the browser to render in quirks mode, rather than standard compliance mode.
Sounds like you are putting IE into quirks mode. If you are using margin:auto; on an element, IE tends to ignore it in quirks mode.
Make sure that the doctype is the very first thing in the file being outputted (no line breaks, spaces, comments, etc.). Also, make sure your page validates against the given doctype.
If the above doesn't work, please post more code.
精彩评论