Link to home
Start Free TrialLog in
Avatar of tonelm54
tonelm54

asked on

php include not absolute

Ive got a php file which holds some constants for my site, I can include them so long as the file is in the same directory by using 'include('const.php'); however to organsise the site I want to use folders, however I cannot reference my const.php file from sub directories by using something like 'include("..\const.php");', the site will be moving around onto several servers, so cant use things like 'include('c:\htdocs\const.php');'

Any simple ideas?

Tony
ASKER CERTIFIED SOLUTION
Avatar of steelseth12
steelseth12
Flag of Cyprus image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tonelm54
tonelm54

ASKER

Sorry me being dumb!
The simplest things are the hardest to spot :)
As steelseth12 stated, using forward slashes is the correct method. The Windows designers decided years ago that they would be cute by using backslashes while the rest of the established computer world used forward-slashes. PHP and Windows know how to play together, so if you use the forward slash, the correct file will be found.