Hey, I have this profile page where I'm going to interpolate different bits of html through php's require function. The problem is when I include, or require, the html may page div drops down 12 or px. I don't have a clue why. I put the html in the php file...required it.. the divs dropped down... I put the html back in the page where I got them from and they went back to normal.. Is there any normal explanation why? I don't really want to include code first off, because it's a pretty good chunk, but it shouldn't matter.. I tried doing this several times with the same results and the html, as far as I can tell, was always cut from the same place...
1) Remove all closing tags for the PHP files. 2) Insure files are saved UTF8 without BOM (check your editor docs for howto). Finally debug the issue using var_dump on each file, see the exact line the issue occurs on.
I'd put an html comment at the start and end of the pages - then view the source to see if anything odd has been put in. Use inspect to find the extra divs - can really help isolate where the problem is. and finally, when you include/require a file ensure that any tags it opens, it also closes
My tip is that the HTML you include/require is a complete HTML-file, with html and head-tags etc. Maybe you even load included files several times. I've never understood the reason for including HTML-files in PHP - just make a combined PHP-file, which has the HTML in the file itself, echoed out.
If you look at this page - that the thread is displayed on - there will be lots of includes and segments of incomplete html. At a bare minimum there will separate code for header advertising navigation analytics stuff twitter feed thread content navigation footer