• Hello all,

    I’m new to WordPress and am authoring my first theme. I’ve been pulling my hair out trying to line-up the top margins for a typical 3 column layout with header and footer. In Firefox, everything is fine but IE7 is adding some extra padding or adjusting the margins for the sidebars flanking the center content. I tried everything and finally determined that this is happening whenever I include a file using the php include directive (e.g., <?php get_sidebar(); ?> or <?php include (TEMPLATEPATH . “/the_other_sidebar.php”); ?>).

    If I take the exact code from the include files and paste it inplace of the include directive, everything displays OK. I even compared the page source from the one rendered with the inline source versus the one using the include directives and they were identical!

    Is there a rational explanation for what’s going on here?

    Any help will be greatly appreciated. I did some searching on the subject but could not find any information but I have to believe others have run into this problem.

    Thanks,

    -Roland.

Viewing 4 replies - 1 through 4 (of 4 total)
  • IE7 – and any browser, for that matter – is oblivious to the PHP code embedded in files running on your server. You probably already know this, but it bears repeating: the only thing that gets sent to your browser by the server is rendered content, not the code itself (the exception being JavaScript, which runs on the client instead of on the server).

    I know it’s hard to argue with the results you’re seeing, but it may be worth asking a couple of questions. When you say the two versions are ‘exactly the same’, is that from eyeballing them, or from using a tool like WinMerge (https://winmerge.org/) to examine the two files byte by byte?

    I ask, because unless the world of programming in PHP has turned upside down in the last couple of days, the answer has to be that something different is being sent to your browser by each of your versions.

    All the best,

    VoodooLogic

    Thread Starter rolanday

    (@rolanday)

    Thanks for the response Voodoo. Yes, I know it’s strange and in theory there shouldn’t be a difference. I’ll try WinMerge to do a byte-by-byte compare.

    Thread Starter rolanday

    (@rolanday)

    Well, thanks for the suggestion. The problem is that everytime I call PHP include a BOM (ee bb bf) is getting inserted, which is why I couldn’t “see” the difference between the outputs. Firefox is just ignoring it but IE7 is not which is why the rendered pages look different. Now I just need to figure out why the BOM is getting inserted and stop that from happening. Any ideas?

    Thanks again,

    -Roland.

    Thread Starter rolanday

    (@rolanday)

    hehe … well that was quick. PHP is doing the right thing but since the file I am including has the BOM at the top, it get’s included (as it should). I’ll just need to remove those extra bytes at the top of my include files.

    Thanks,

    -Roland.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Strange behavior in IE7 when calling php include’ is closed to new replies.