So I set up my include files, such as header.php
, nav.php
, and footer.php
in a /inc
folder.
Then I include the files in my pages. But if I have another folder, for example wiki
where i'd like to include those files onto the pages of wiki, the file paths for the includes break.
Example: I have included this in a page from the wiki
directory.
<?php include_once('../inc/header.php'); ?>
I have two other includes in the header.php file, but since I'm including them in a different directory, both includes break, unless I go and append a ../
in the include path.
I'm wondering what is the best way to include files within different directories and not having to go back and fix the path?