I'm running XAMPP for Mac.
When I first started working with PHP, I would define my directory with a variable:
$root = "http://localhost/~aaron/SiteFolder/"; // Dev
$root = "http://www.sitename.com/"; // Live
This will work, but it's a huge annoyance having to comment one out, depending on if I'm editing the dev site or the live site.
I'm slowly transitioning over to OOP habits and want to maximize efficiency if at all possible. So I'm attempting to define ROOT with the current directory as shown here:
define("ROOT", dirname( __FILE__ ) . DIRECTORY_SEPARATOR);
This outputs:
/Users/aaron/Sites/SiteFolder/
This is not entirely useful to me when I'm working on the dev site, because I want to be able to use ROOT
as a prefix for my images, files, etc.
This obviously won't work:
<img src="/Users/aaron/Sites/SiteFolder/images/charizard.png">
What do I need to do to fix this problem to properly define my directory?