I have some files that I need to include in several pages so, I use something like
<html>
<head>
<title>This is a webpage</title>
</head>
<body>
<div>Hello, this is a webpage</div>
<?php include("header.html");?>
<div>Some more text.</div>
<?php include("BlockToInclude.php");?>
<div>Even more text.</div>
<?php include("footer.html");?>
</body>
</html>
The problem is that with each include(); I get a blank space of 20px before the included content. I get around this this by reducing the margin of the first included block by 20px, but I would prefer something that avoid this space instead of compensate it. Also, I’m kind of new to PHP, is this a normal behaviour or should I look for something I’m doing wrong?
UPDATE: I checked in the resulting code and in every spot where I called an insert(); function it appears an stranger character that is not in the original file (nor the caller or the included). I copied the code from the Firefox code viewer (where is not visible) to my editor (RJ TextEd in Windows) where it appears as a question mark in a box; if I save this code as an static html it renders the same, but if I delete those characters then the blank space disappears. Any thoughts?
I found this topic here
Someone sais:
I’ve had this problem before. Make sure you upload your file in ASCII not Binary. Sometimes, with some FTP servers, you have to set this manually. Also try converting your newlines to “\n” in your text editor. Lemme know which editor you’re using and I’ll give you more specific instructions.
http://forums.digitalpoint.com/showthread.php?t=957679
And someone solved it :
I solve this problem using notepad++ (http://notepad-plus.sourceforge.net/)
Open php files with notepad++ and in Format menu chose encode in utf-8 without BOM and save it.
Hope this helps to