Include pages in PHP - IE position error (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


GolfMad -> Include pages in PHP - IE position error (3/8/2008 6:25:16)

I have Googled this problem without success and was wondering if anyone here knows why or how to fix this:

Structuring a template called index.php, in between say the menu div it has this class:
#menu {
padding: 0px;
margin: 0px auto 0px auto;
background-image: url('images/content.png');
background-repeat: repeat-y;
width: 800px;
height: 30px;

The only other code in this div is:
<?php include('_menu-incl.php'); ?>

On the _menu-incl.php page we have the code:
<div id="awmAnchor-menu"></div>
I promise there is no silly code like breaks or paras there!

Now, in Firefox the browser displays the same result whether the include set up is used, or if I just place the code directly in the *menu div
But in IE7, using the include method, it forces the menu to slightly overlap or be right on the bottom and ignore padding, making a larger top margin or padding appear from somewhere.

I also found the same error when I tried an include page method for the simple div undeneath the menu div, to contain the sites name in a single graphic.

So IE7 has done this on two counts yet FF is fine.

Does anyone know the reason or a fix please?

Thanks
Phil




Tailslide -> RE: Include pages in PHP - IE position error (3/8/2008 6:34:12)

Can you post the link please as using an include like that won't be affecting the end result (it's parsed before the browser sees the page). Maybe stick up a version using the include and one that doesn't use it so we can see where the difference is.

So something else is going on there.

Just check:

Nothing at all else on the include page apart from the actual code to be included (no html or body tags etc).
Are you really just including an empty tag?
Try renaming the include file without the "_" maybe that's causing a problem. I try not to have anything unusual starting a file name.
Check that the generated markup is exactly the same with the include as without it - maybe there's something extra being added in there when you add the include call?




GolfMad -> RE: Include pages in PHP - IE position error (3/8/2008 6:58:32)

Thanks Tailslide.

Here is the link with the club name and menu divs with the code directly in them:
http://tgc.sitesoon.co.uk

Here is the page where I have used include pages for the club name and menu. Strangley enough, the club name is now not being forced 5 pixels towards the bottom anymore in this version (I think I added a div tag to the image and text in that name div, yesterday after the problem first occured, to fix something else) but the menu div underneath it still is:
http://tgc.sitesoon.co.uk/index-with-incl.php

<div id="name"><?php include('_name-incl.php'); ?></div>
<div id="menu"><?php include('_menu.php'); ?></div>

_name-incl.php:<div class="nameleft"><img alt="" src="images/name21.gif" width="526" height="35" /></div><div><?php

include("dt.php");
show_dt(0,"l, jS F Y. g:ia");

?><br />
<a target="_blank" href="http://www.bbc.co.uk/weather/5day.shtml?id=3117">BBC current weather for Tavistock</a></div>

_menu.php
<div id="awmAnchor-menu"></div>

Lets hope you can spot it, I will end up with about 30 pages and the php include will help for future changes. (using PHP for content management later in the site)

By the way I have just made these changes to the mocked up page in the new EWD 2 Beta, - seems really cool being able to insert aphp include page from the Insert Menu!

Regards
Phil





Tailslide -> RE: Include pages in PHP - IE position error (3/8/2008 7:38:19)

Ok well there's no difference in the browser source

BUT

When I pasted both into a text editor to compare them I found this in the page with an include:

<div id="menu">?<div id="awmAnchor-menu"></div></div>

Spot the "?"

My guess is that there's a ? floating around somewhere - maybe from a PHP tag.

Can you post the section from the markup that includes the include call , e.g this:
</div>

<div id="menu">
  <?php include('_menu-incl.php'); ?> 
</div>

<div id="content">




GolfMad -> RE: Include pages in PHP - IE position error (3/8/2008 9:09:23)

Thats interesting, I really do not know where it is finding the "?"

<div id="wrap">

<div id="top"> </div>

<div id="header">
</div>

<div id="name"><?php include('_name-incl.php'); ?></div>

<div id="menu"><?php include('_menu.php'); ?></div>

<div id="content">

<div id="center1">

This is the _menu.php
<div id="awmAnchor-menu"></div>

Really weird

Thanks
Phil




Tailslide -> RE: Include pages in PHP - IE position error (3/8/2008 9:20:40)

You could try opening the include file and the HTML page itself in Notepad and check there's nothing going on there. Then save the files and see if that helps!




GolfMad -> RE: Include pages in PHP - IE position error (3/8/2008 9:28:43)

This is the main php file that calls the include copied from Notepad:

<div id="wrap">

<div id="top"> </div>

<div id="header">
</div>

<div id="name"><?php include('_name-incl.php'); ?></div>

<div id="menu"><?php include('_menu.php'); ?></div>

<div id="content">

<div id="center1">


This is the _menu.php from Notepad:

<div id="awmAnchor-menu"></div>

No sign to me of that spare "?"

Thanks
Phil




Tailslide -> RE: Include pages in PHP - IE position error (3/8/2008 9:44:44)

don't know where it's coming from but it's definitely the problem - when I save it to my desktop and open in IE7 there's no gap without the ? and the gap appears when the ? is added.




GolfMad -> RE: Include pages in PHP - IE position error (3/8/2008 9:59:20)

I renamed the include file to just menu.htm and updated the call but that did not solve it.

<div id="name"><?php include('_name-incl.php'); ?></div>

<div id="menu"><?php include('menu.htm'); ?></div>

<div id="content">

<div id="center1">

Have we 'hit the wall' here and that it is some weird IE bug no one has discovered yet.

The strange thing was it was also happening to the name div above it until, i accidently cured it yesterday by making the two elements of an image and text have divs surrounding them, tehm the problem i was having with the date and BBC weather text lining up right disappeared as well.

Thanks again
Phil




jaybee -> RE: Include pages in PHP - IE position error (3/8/2008 10:22:01)

Are you using EW to do your PHP? If so you'll get all sorts of odd things happening. EW screws up PHP. Even MS admit it. They want you to use .Net.

Use a text editor or a proper PHP editor and make sure your files are saved without a Bite Order Mark (BOM)




GolfMad -> RE: Include pages in PHP - IE position error (3/8/2008 11:03:16)

quote:

Bite Order Mark

I dont quite understand what this is but another MVP warned me about it in EWD with PHP.
I have just this morning installed EWD2 Beta with support for php.
What should I do with my exisitng index.php, do I have to scrap it completely and build it again in EWD2, togehter with a new page from scratch called menu.htm as if I called it menu.php originally it may have this BOM hidden in it.

Thanks
Phil




jaybee -> RE: Include pages in PHP - IE position error (3/8/2008 12:55:16)

If you're not saving as UTF-8 or 16 don't worry about it.

I'll be interested to know how the Beta support for PHP goes. Version 1 is a PITA if you work with PHP a lot.

Explanation of BOM ie. 3 weird characters that suddenly appear in your page when using PHP.




GolfMad -> RE: Include pages in PHP - IE position error (3/8/2008 13:46:55)

Thanks Jaybee, I'm saving as php or htm.

Read the article and a bit confused but will take more time later, seems like some editors mention there will strip out the BOM.

My php page that was created with EWD original, placed this meta tag in the header:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

So am I saving as a UTF-8 file please?

The new EWD2 Beta also mentions something about it here, it seems they have tried to cure it:
http://www.microsoft.com/expression/products/readme.aspx?key=web2beta

Regards
Phil




jaybee -> RE: Include pages in PHP - IE position error (3/8/2008 19:42:54)

quote:

charset=UTF-8


Yes.

See how it goes with the beta. If you get problems then download UniRed text editor and before you upload any PHP files, open them in that and

Save As> with a file type of UTF-8 No BOM.

But it looks like they now automatically save with no BOM which is interesting, cause when I originally raised it with MS I got told it wasn't a problem and so they wouldn't change anything.

This despite the fact it was screwing up css files as well. If you look at some of them you'll see 3 odd characters on the front.




GolfMad -> RE: Include pages in PHP - IE position error (3/9/2008 4:01:23)

Thanks for your help and patience Jaybee and you have told me exactly what I wanted to know about how to remove the BOM.

As the page was made with EWD original and it will be a template for 30 pages, I think I might clean as you suggest and I guess paste the clean text back into a new page in EWD2Beta. Hopefully it will be trouble free after that with the new EWD2.

Thanks again

Regards
Phil




jaybee -> RE: Include pages in PHP - IE position error (3/9/2008 8:56:44)

No need to paste back in. Just open in Unired, remove any odd characters on the front, save as your normal file type (html or css) but with encoding UTF-8 No BOM. If you save over the top of the original then you can open as normal in EW2.




GolfMad -> RE: Include pages in PHP - IE position error (3/10/2008 10:30:35)

Some feedback after all your kind help thanks Jaybee, it actually worked to stop that gap appearing.
The UniRed program did not seem to have an option for saving without BOM for 8 bit, only 16 and 32 but in that link you gave me explaining it, another editor was mentioned, Babel Pad and this enable saving without BOM for 8 bit.
I placed all the php files and htm, css through it, saving without BOM as suggested, uploaded and - the gap had gone in IE7!

Fiddling around with the Site Settings in EWD2 Beta I notice that the default is to save with a BOM for all extensions except PHP, so I wonder whether there will be any problems in the html and css files now I have stripped the BOM out.

Regards
Phil




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.125