I don't really know the best way to ask this question without sounding dumb so here it goes anyways:
When I include files in my php code I prefer to use something like this:
require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/Database.Class.php");
This makes it easier to organize files. No big deal.
The problem I have is with the variable $_SERVER['DOCUMENT_ROOT']. With my web hosting it maps properly to the website (i.e. /home/username/websitename) but locally on my computer (running xampp) it maps to /Applications/xampp/htdocs
The problem with this is that I am working on a couple of different websites and keep them in folders within the htdocs folder (i.e. /Applications/xampp/htdocs/websitename).
So how can I change this locally so it points to /Applications/xampp/htdocs/websitename WITHOUT me having to add code to every single php page? Is there something I can do in Apache or the php.ini file?
Ideally it would work the same as my web hosting, so that for multiple folders it would map correctly to that folder (i.e. the path /Applications/xampp/website1 would be the DOCUMENT_ROOT in the folder website1 but the path /Applications/xampp/website2 would be the document root in the folder website2)
Thanks
Steve