0

So I've tried looking around in other questions, but can't seem to find a question consistent with my problem.

What's going on is that I have been working on a project using angularjs, and primarily working on pure html for most of the development, and am finally at a stage where I want to cut out the header/footer code and bring it in as php with includes.

However, include("../Includes/header.php"); is not working. Other includes with basic code seems to be working okay. Here's my code:

<?php 
    //require_once ("Includes/simplecms-config.php"); 
    //require_once  ("Includes/connectDB.php");
    include("./svg.php"); 
    include("../Includes/include.php");
    echo "<i>This is an echo from the current file.</i><br />";
    include("../Includes/header.php");
?>

This is the code from ../Includes/include.php:

<?php
    echo "<b>This is an included echo from another directory.</b><br />";
?>

the .svg.php file is irrelevant, just some svg graphics I use. If I move the include header ABOVE the echo, then nothing shows up. If I have it below (like it is in the code above), the echo commands work, but everything stops after the include header.

There are no errors that I can seem to find, no warnings, no nothing...just not outputting anything past that specific include.

(Working with Microsoft WebMatrix if that is even remotely relevant)

  • Oh, I wanted to also add (b/c I forgot) that the exact same include line/php code, using the exact same header.php file works perfectly fine on every other file. This particular file calling it however is the only one not currently in a parent directly (e.g. it has to go up a directory and then back into /Includes/ before reaching the file). I did copy/past the entire Includes directory in the folder the one I'm working on is in, and it worked okay...but that's not really a great solution for me :) – Melanie Yaun Apr 17 '16 at 18:15

1 Answers1

0

This might be a shot in the dark but in general it's best practice to leave the closing ?> off of php-files. I don't see how that could affect including a file, but I also don't see anything else "wrong" with your code.

eFrane
  • 89
  • 1
  • 6