tags:

views:

124

answers:

5

the normal one:

http://labvc.x10hosting.com/AT/site/home.htm

VS

the odd one:

http://labvc.x10hosting.com/AT/site/home.php

when i look at the code side by side, its almost identical, the only thing that would make them give that weird gap should be the CSS but they're using the same sheet.

ideas?


EDIT: I checked and made minute changes to the code, look again at the source.
Both are EXACTLY the same. wtf is with this gap.


EDIT: there's a pixel wide character just before the xml deceleration, how do i stop it form occurring?

+4  A: 

There's a  on the php one at the top of the page explaining the gap IMHO

RC
A: 

You have an extra bit of white space at the top of the PHP file's source code (before the xml declaration).

Chris
how do i stop it from doing that?
Brae
+2  A: 

The php page generates a "." before the doctype which explain the extra space

the html page

<!DOCTYPE html

    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

the php page

.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

delete any code above the doctype in the php page

martani_net
+3  A: 

Your PHP output has a double byte-order-mark at the head.

Inspecting your code with Firebug, I see this as the first line

<?xml version="1.0" encoding="UTF-8"?>

Now, all those funky characters there are just ISO-8859-1 decodings of the UTF-8 BOM (0xEF 0xBB 0xBF).

These are possibly added by your IDE/editor into the head of the PHP files themselves. Check your preferences and see what encoding is being used. If it's something like "UTF-8 + BOM" then switch it to just "UTF-8" and that should fix it.

Peter Bailey
every single file is saved as utf-8, how do i get rid of it?
Brae
Something is injecting the BOM into your files. Download a hex editor and open them locally to see if they're there. Or open them with an encoding-aware text editor like EditPlus - it will tell you if there's a BOM or not.
Peter Bailey
opened everything in notepad++, all clean. where the hell is this thing :S
Brae
Are you *sure* it's clean? The BOM is not a visible character (normally). You can't just open it in a text editor and look for a space. You need to inspect the bytes.
Peter Bailey
notpad++ supports all the usual encodes, how do i find/edit/remove this bytemark? i think ill copy paste out the code into a new set of files to replace my other ones, but ill do that later, i been up too long. check back later for progress.
Brae
When in doubt, open it with a hex editor (http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm) and look at the first three bytes. If it's EF BB BF then you're stricken with the BOM!
Peter Bailey
yep, i got a bad case of the BOM. i deleted the pesky bytemark from all my files, works perfectly now, thanks a heap man!
Brae
How to remove the BOM with Notepad++: open the offending file, select 'Encode in UTF-8 without BOM' from the 'Format' menu, save.
djn
+1  A: 

If you're including any files at the top of the PHP file it could be that you actually have whitespace or a period AFTER the ending ?> in the included file

header.php
<?php
  phpstuff...
?> <whitespace or period here>

home.php
<?php
  include "header.php";
?>

This can be solved by never using ?> in pure PHP files. It's ok to leave it open like this:

<?php
  phpstuff...
Tor Valamo
checked, corrected, still bugging. anything else?
Brae