Include folder structure

A

Anonymous

Guest
I tend to have a config file for the project, which is something like....

Code:
<?php
$ROOT = $_SERVER['DOCUMENT_ROOT']."/Test1";
$loggedIn = false;

include_once "$ROOT/components/util/ErrorHandler.php";
?>

which gets included first everywhere. This has a fixed value for $ROOT which as you can see is then used as part of the include path.
You could have 2 versions of this - which would work - but you'd have to be careful when you copy it to a live environment. Or you could modify the code to look at the domain name and if it was your live domain, then set $ROOT accordingly.
 
Back
Top