This question already has an answer here:
I've been working on a small site, to work on my PHP Skills. I've got the navigation inside of a sub-folder called Templates. Now basically, the navigation is going to be included on every page, and along with it connect.php. Now the problem is, if it goes into another sub-folder then it isn't going to be able to find the connect.php file. I've got the APP Directory setup, and that is working on the Stylesheet and all.
However I'm not sure how I would do the include, I got the idea/code for the link href from StackOverflow on another question and on that it said that include (APP_DIR .'connect.php')
however that doesn't seem to work for me, it brings up an error "Warning: include(APP_ROOT/connect.php): failed to open stream: No such file or directory in C:\xampp\htdocs\ytsite\templates
avigation.php on line 2
"
Any help on how to correctly include a file so no matter where it is, it includes the connect would be much appreciated.
Thanks, Ben
</div>