Quick Rookie Question. Ive searched SO for answer but what I found wasnt really clear or addressed my particular problem as you can see here, and here.
Im trying to add a script in a different directory however this will result in all my require() paths to be wrong.
How can I move files around / change directories without having to modify my require() statements, if possible at all?
I believe __DIR__ is what Im looking for as pointed out in this question, however in linked question the answer used __FILE__ instead of __DIR__ , which I dont quite understand..?
Example
Consider this, my current working directory
require_once '../config/connection.php';
require_once '../views/head.php';
require_once'../classes/register.php';
:
:MORE CODE
If I move the require statments to the scripts directory, as can be seen in image, it will result in not found error.
Is there anyway how I can avoid this except for appending another 2 ../ to each require() statements.
Hope my question makes sense...? Is it possible to do what Im trying to achieve?
Thanx
