Jump to content

Extra Line Breaks Not Added By Me, Coming As Result Of An Include


Jim R

Recommended Posts

http://metroindybasketball.com/fall-league-2012/

 

Check out the tabbed content. Under Standings and Schedule, both are information from INCLUDEd php files. Using Firebug, it reveals there is a <p> and three <br />'s that I didn't add. They only show up when I put in the INCLUDE.

 

How do I go about getting rid of that? I don't see that it's part of the page code.

Link to comment
Share on other sites

I don't know what you're looking for other than "go find where the code does that and stop it". You've given no framework name, style of include, or anything else. Just "my code prints something and I'd like it not to." Well...go stop it from doing that.

 

How is the content doing that? How is the file even being printed? Go find the function or whatever that causes these boxes to show up, and see if they print the extra lines. if they don't, see if there's more functions or includes in that section, and follow them until you find it.

Link to comment
Share on other sites

One piece of pro - advice I can give you... do not include the php end tag in your files -- especially ones that include functions and classes, and are included in other files, as in the situation you described.

 

One reason for this... if you have a file like this:

 

<?php

function somefunc() {
}

?>

. 

 

Just an extra line of whitespace after the end tag, will be enough to trick php into thinking you intended to drop out of a php block and into an html block. You also need to be careful you don't have whitespace before a starting php block, as this will also be seen as html, that should be sent as output.

 

If you leave off the end tag, you eliminate the problem with inadvertant whitespace in includes causing output.

Link to comment
Share on other sites

Using WordPress, I wonder if that messes with how it processes the PHP within Posts and Pages. WordPress doesn't inherently let Users use PHP within Posts and Pages. There are a few good plugins that allow that, some using short code syntax, others just letting the User us normal PHP tags. Most (any that I would use) let the Admin determine who can use PHP in Posts, and in this case, just me.

Link to comment
Share on other sites

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.