1

I'm working on a startup that requires a website. I'm doing this by writing many separate php files and then having index.php for a page load them each with require_once('file.php') function(parameters), and that's been working just fine (and has always worked for me).

I'm getting a very peculiar error. My index page looks something like this:

<?php
require_once('load_heading.php');
require_once('load_header.php'); header(stuffs)
require_once('load_content.php'); content(foobar)
require_once('load_footer.php');
?>

Everything has been working totally fine for my other pages, but for this particular page, the footer, which is in load_footer.php, shows up in the middle of the contents load_content.php adds to the page...

Has anyone encountered similar errors, or knows a solution? If it means anything, load_content.php pulls information from a database and puts it in a so it looks neat.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
  • 1
    It sounds extremely likely that there is a problem with the HTML that is emitted – Explosion Pills Jul 17 '13 at 21:58
  • What are you trying to display? I could be something as simple as a div not getting closed etc. Have you checked if the page validates (or throws more errors on the page with the problem)? – Alex L Jul 17 '13 at 21:59
  • Let me bet: load_content.php `require()`s or `include()`s load_footer.php. – Eugen Rieck Jul 17 '13 at 22:00
  • Hmm, just finished double checking the tags -- everything opens and closes in the right place, and I DEFINITELY did not require() or include() load_footer.php in load_content.php. @Alex: I'm trying to display some images that I have in the same directory -- those show up without a problem. I'll paste a link to a screenshot of the webpage when I can (at work, and they block my free DNS). Thanks for your helpfulness. – Utkash Dubey Jul 17 '13 at 23:10

1 Answers1

2

I can not comment due to rep yet. Things I would check first:

  1. Check the HTML source of the loaded page. Sometimes a missing closing tag etc can throw off the layout
  2. Make sure you didn't include/require load_footer.php in the load_content.php file [it happens just double check :)]
  3. Could be a CSS issue with your footer.
  4. Could be PHP errors so put this at the top of your code (or edit your php.ini file):

    ini_set('display_errors', 'On');
    error_reporting(E_ALL);
    
Ishikawa91
  • 404
  • 4
  • 15
  • 1. Did check this, and added/subtracted s multiple times just to make sure -- doesn't seem to solve the problem. 2. Haha, I wish it was this one... Unfortunately it isn't :( 3. I tried the page without any CSS (got rid of div ids, commented out all of my css), and it shows the same thing but barebones. Thanks for your list, I'll keep at it. – Utkash Dubey Jul 17 '13 at 23:14
  • I did some searching, Check your PHP error reporting settings. Try putting these 2 lines at the top of your main page: ini_set('display_errors', 'On'); error_reporting(E_ALL); – Ishikawa91 Jul 18 '13 at 15:38
  • Figured it out -- a for loop that was closing my tables was set so it wouldn't close the very last one. It now works fine. Thanks for the help! – Utkash Dubey Jul 19 '13 at 06:41