php require / include adds line break to html
Posted: Fri May 15, 2009 12:33 pm
I have a problem which has been occurring on several of the sites I've built lately. It seems when I include the the footer file on each page a line break gets added to the html which isn't good for designs where a color is supposed to be flush with the footer.
Here's an example:
http://216.151.1.137/~shopauto/
here's what the require code looks like:
Very basic (and I have tried using parentheses instead).
The footer.php file is very basic too:
It's not a CSS issue (though I know it seems like it is). To illustrate that point I tried to leave the first part of a closing div tag in the file which is including the footer (index.php) and then finished the tag in the footer:
end of index.php:
beginning of footer.php:
And this is how it looks in the source code . . . actually, I can't even paste it, I'll have to use a screenshot:

Any thoughts. My sense is it's something with the DOCTYPE or encoding type or something like that which I don't understand.
Here's an example:
http://216.151.1.137/~shopauto/
here's what the require code looks like:
Code: Select all
require "inc/footer.php";The footer.php file is very basic too:
Code: Select all
<?php
print "
</div>
<div id='footer'>
© 2009 All Rights Reserved.
Website Design by <a href='http://www.dwstudios.net/' style='color:#666666;'>Darkwater Studios</a>
</div>
</div>
</body>
</html>";
?>end of index.php:
Code: Select all
...print "
</div";
?>Code: Select all
<?php
print ">
</div>...

Any thoughts. My sense is it's something with the DOCTYPE or encoding type or something like that which I don't understand.