tibberous Posted August 13, 2008 Share Posted August 13, 2008 This one is hard to explain, so I'll use an example. I have include files: smptemail.php actions/emailfunctions.php And emailfunctions includes smptemail.php as ../smptemail.php. And this works, UNLESS emailfunctions.php if referenced from a directory other than the root one. I can think of four solutions. - Use symbolic links - Copy the text of smptemail into emailfunctions - Hard code paths - include based on file_exists. I'm going to probably go with four, but is there a better way to handle this? Like an include that looks for includes relative to the including file, not the main file? Quote Link to comment Share on other sites More sharing options...
geudrik Posted August 13, 2008 Share Posted August 13, 2008 Try using... $_SERVER['DOCUMENT_ROOT'] and creating a string thats essentially absolute. Quote Link to comment Share on other sites More sharing options...
tibberous Posted August 13, 2008 Author Share Posted August 13, 2008 You know what, that might not be a bad idea. I'm using a lot of subdomains, which change it, but I almost forgot that was even an option. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.