Absolute path issues in PHP on localhost in OS X

MRI48

New Member
I'm having some issues with defined absolute paths in PHP. I define the \[code\]SITE_ROOT\[/code\] and \[code\]APP_PATH\[/code\] like so:\[code\]defined('SITE_ROOT') ? null : define('SITE_ROOT', str_replace('//','/',dirname(__FILE__)) );defined('APP_PATH') ? null : define('APP_PATH', SITE_ROOT.DS.'application');\[/code\]When using the \[code\]APP_PATH\[/code\] in an application like so:\[code\]echo APP_PATH;\[/code\]...this is what I get:\[code\]/Users/user/Sites/MyWebsite/application\[/code\]What I want is for the output to be:\[code\]localhost/application\[/code\]Is there any non-kludgy way of doing this?My use case is to use the \[code\]APP_PATH\[/code\] (already in use for doing all my \[code\]require()\[/code\]'s) echoed out with HTML to avoid relative pathing problems within URLs for \[code\]href\[/code\]'s.
 
Back
Top