ragebunny
ragebunny

Reputation: 1760

Internet Explorer not rendering pages correctly because of a PHP class

I have a very strange problem and i don't know what to do about it. My site seems to work just fine all browsers other than internet explorer, so i've been trying to figure out why.

I've narrowed it down to the a file that I'm including in my site, this file is a php class that has a number of different functions like login getters and setters and so on.

I took all the php code out of my pages and it renders fine, so i added the php back in line by line and released that it stopped working when i used this:

 require_once 'classes/Membership2.php';

Does anyone know why some php code will be messing with the style of my website.

For more detail on the matter, i have a number of divs that are centered, they all have curved edges as well as shadows. So by taking away the php i can see that IE is loading the page properly, no incompatibilities or anything like that.

Has anyone had a problem like this before? While i'm waiting for an aswesome or two i'll be removing functions and part of the code till i can narrow it down. (I would give code, but the file has a lot of lines of code.)

Thanks for the help.

Oh yeah and I'm testing on Internet Explorer 9 and every other browser is the latest version or close enough.

Okay so i've done some more digging into this, i've found that if i delete all the code in the class (All the functions) and leave just and empty class in the include file it still doesn't work. Okay, so in my view that means the functions aren't whats making this problem. So i deleted EVERYTHING, so now the include points to a blank php file. This worked and the page rendered as it should but obviously there is no functionality, i can't login or anything like that. I decided to add a constructor instead of leaving it as default, this function does nothing but return true; and it made the site mess up again.

Does this info change anything? Also i'm reiterating the fact that i do not get this error or any other browser but Internet Explorer 9 (Haven't tried any other IE version).

Thanks again for the help.

Okay, so i've solved the problem. At the start of my PHP class i have used

 <!-- blah blah blah -->

forgetting that there is only PHP in this document and no HTML. So when i include the file it just outputs that into my source code and and messes things up, should have used the PHP commenting style.

Still strange that EVERY browser other than IE just ignores this and goes about its business, even the site that @blankabout suggested didn't give me any error (Although i assure thats because its part of the included PHP file and not the HTML itself).

Upvotes: 0

Views: 837

Answers (2)

Saic Siquot
Saic Siquot

Reputation: 6513

as @fajran says to you, save both outputs with "view source code" on the browser and compare them to find the diference. To compare outputs use winmerge or similar tool. Once you now which text it generating the trouble, modify it inside the include file.

Upvotes: 1

blankabout
blankabout

Reputation: 2627

Given that your php, because it runs on the server, should never actually reach the browser, it may very well be some unterminated HTML or similar that is causing the problem. Perhaps the PHP is causing a break in the HTML that is unexpected.

Upvotes: 1

Related Questions