Jim R Posted October 6, 2012 Share Posted October 6, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/269147-extra-line-breaks-not-added-by-me-coming-as-result-of-an-include/ Share on other sites More sharing options...
ManiacDan Posted October 6, 2012 Share Posted October 6, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/269147-extra-line-breaks-not-added-by-me-coming-as-result-of-an-include/#findComment-1383154 Share on other sites More sharing options...
Jim R Posted October 6, 2012 Author Share Posted October 6, 2012 I found the solution. I had some meta data on the files for the INCLUDE. Deleted all the normal HTML stuff that heads off a html file, and it solved my spacing issue. Quote Link to comment https://forums.phpfreaks.com/topic/269147-extra-line-breaks-not-added-by-me-coming-as-result-of-an-include/#findComment-1383155 Share on other sites More sharing options...
Jim R Posted October 6, 2012 Author Share Posted October 6, 2012 @ManiacDan, I was looking for general advice from someone who might've experienced this in the past. I could've said the tabs had nothing to do with it because it was doing it before I added the tab short code. Quote Link to comment https://forums.phpfreaks.com/topic/269147-extra-line-breaks-not-added-by-me-coming-as-result-of-an-include/#findComment-1383156 Share on other sites More sharing options...
gizmola Posted October 6, 2012 Share Posted October 6, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/269147-extra-line-breaks-not-added-by-me-coming-as-result-of-an-include/#findComment-1383166 Share on other sites More sharing options...
Jim R Posted October 6, 2012 Author Share Posted October 6, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/269147-extra-line-breaks-not-added-by-me-coming-as-result-of-an-include/#findComment-1383236 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.