Question

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.

Was it helpful?

Solution

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);
    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top