Jump to content

Recommended Posts

When I put PHP code in my site, it doesn't make any extra space, when I include it as a file, it makes one new line. Why? There is no </br> tag anywhere. :(

 

<div id="left">
<?php include('includes/navigation.php'); ?>
</div>

 

This doesn't make any space.

 

<div id="left">
<ul>
	<li><a href="index.php?nav=list">List Work</a></li>
	<li><a href="index.php?nav=new">New Done Work</a></li>
	<li><a href="index.php?action=logout">Logout</a></li>
</ul>
</div>

 

This does. :(

 

Even when I make it like this, still does the same.

 

<div id="left"><?php include('includes/navigation.php'); ?></div>

 

Also, Chrome element inspector shows this:

 

<div id="left">
"" <- What's this? :S
<ul>
	<li><a href="index.php?nav=list">List Work</a></li>
	<li><a href="index.php?nav=new">New Done Work</a></li>
	<li><a href="index.php?action=logout">Logout</a></li>
</ul>
</div>

Link to comment
https://forums.phpfreaks.com/topic/258900-included-php-widgets-make-extra-space/
Share on other sites

When you do a 'view source' of the page using the php include, what do you see and where exactly is the extra space at?

 

I suspect your navigation.php file is saved with the BOM (Byte Order Mark) characters it is the BOM that is causing the extra space.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.