Reputation: 2289
I am trying to include a header/footer with php's include_once
. I did not have any trouble until I created a sub-folder called, "states". I tried to include include_once("header.php");
and it is failing. I know it is because it is not in the same directory, so I tried include_once("/header.php");
and that did not work. I also tried doing this:
include_once("header/states.php");
include_once("header/.php");
What am I doing wrong for this to not get to the correct directory? I am trying to organize a bunch of files and I want to do this the correct way, so any help appreciated.
Upvotes: 0
Views: 24
Reputation: 1945
Use ./ to reference the current directory:
include_once("./states/header.php");
That's assuming the file you are referencing from is in the directory shown. If it's in another directory ( like _notes ) then the directory one level up can be referenced by ../, thus:
include_once("../states/header.php");
Upvotes: 1