• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

php include causes gap in web page

Hello,

I havn't seen this problem before but when I use a php include to grab my left nav it causes a strange gap that I cant get rid of.

I have just moved to a new server and Im wondering if it could be something to do with that?

Thanks
Steggs
<?
	include("solutionsMenu.php");
?>

Open in new window

0
Mark Steggles
Asked:
Mark Steggles
  • 8
  • 5
2 Solutions
 
Mark StegglesWeb DeveloperAuthor Commented:
Looking at the source there is a strange little character at the very beginning of where include starts
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you probably have some space or newline in the solutionsMenu file itself
0
 
Mark StegglesWeb DeveloperAuthor Commented:
I dont believe so... solutionsMenu is attached as a txt file
solutionsMenu.txt
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Ray PaseurCommented:
Maybe you can show us the PHP code and the URL where this occurs?  It is hard to guess what might be happening, but if we can see there may be an answer.
0
 
Mark StegglesWeb DeveloperAuthor Commented:
Sure. Here is the url http://www.futurekode.com/quadtego/solutions.php

see the gap at the beginning of the left nav

I see a small character when I view the source in chrome but not firefox
0
 
Ray PaseurCommented:
Yes, I can see an unprintable character at position 18 on line 59 of the generated HTML.  But this is not in the solutionsMenu.txt that you posted above.  Maybe if you can show us the PHP code we can see where the extraneous character is coming from.

Who is your new hosting company?  Do you still have the site accessible on the old host?
0
 
Mark StegglesWeb DeveloperAuthor Commented:
the php is just like this:

<div class="leftCol">
            <?php
                  include("solutionsMenu.php");
            ?>
      </div>

My new host is hostgator.com

I meant that I had used that same php include on another site which was on a different host and didnt have this problem

This is weird
0
 
Mark StegglesWeb DeveloperAuthor Commented:
check out this page now that I have taken the menu from the include and just pasted it into the page without the include http://www.futurekode.com/quadtego/pci-compliance.php

Compare that to the other solutions pages which are still using the include
0
 
Ray PaseurCommented:
Yes, I can see the difference, for sure.  I would almost say you need to call the tech support at HostGator, but first let's try replacing that code segment above with this (copy and paste).

There may be an unprintable character in your text editor copy of that code.  This should eliminate that.  It's at least worth a try.

best, ~Ray
<div class="leftCol"><?php include_once("solutionsMenu.php"); ?></div>

Open in new window

0
 
Mark StegglesWeb DeveloperAuthor Commented:
0
 
Ray PaseurCommented:
Close all instances of your browser(s) and restart then refresh the page.  It looks OK to me now.
0
 
Mark StegglesWeb DeveloperAuthor Commented:
I just fixed it :)

Hostgator technician found this link: http://www.alifelessordinary.com/html/archives/2009/02/weird_gap_with_php_include.php

Taking the contents of the solutionsMenu.php and simply recreating the file fixed the problem. I must have selected some weird setting when I saved it before

Thanks for your help
0
 
Ray PaseurCommented:
Great!  Glad you're on the right track.  Best regards, ~Ray
0
 
Mark StegglesWeb DeveloperAuthor Commented:
For anyone who might stumble across this solution that has the same problem:

CHECK THAT YOU ARE NOT SAVING YOUR FILE WITH ENCODING SET TO 'save file with a Bite Order Mark'
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now