cutebird75 Posted April 23, 2008 Share Posted April 23, 2008 Hello every body! I am not very genious in programming. I am working on a online system. I have my connection file in "home/config/connection.php" directory. Now I am accessing this file through include ('../connection.php') on first level and include('../../connection.php') on second level. I have to mention all this in each file. but the problem is that if I have to change my directory structure or relocate files to a new place then I will have to change path manually in all files. if there is any specific solution to solve this problem.please tell me about it in datail. Thanks alot. Quote Link to comment Share on other sites More sharing options...
NikkiLoveGod Posted April 23, 2008 Share Posted April 23, 2008 You can make yourself a config file, where you make a variable for every path to your files. for example, yuo make a config.php with $connpath = 'home/config/connection.php'; $someotherfile = 'someotherpath'; then you just include this config file to the files and use include $connpath; and all you have to change is the config file. I'd do it that way, if someone has a better solution, please do tell it -NikkiLoveGod. Quote Link to comment Share on other sites More sharing options...
cutebird75 Posted April 23, 2008 Author Share Posted April 23, 2008 but the problem is still there. when i will include config file to all other files it would also require relative path to the config file. and i will have to manually tell the path. this is my original problem.please keep in mind this point. Quote Link to comment Share on other sites More sharing options...
discomatt Posted April 23, 2008 Share Posted April 23, 2008 Use absolutes. $_SERVER['DOCUMENT_ROOT'] helps with this Quote Link to comment Share on other sites More sharing options...
cutebird75 Posted April 23, 2008 Author Share Posted April 23, 2008 Please tell me in detail Quote Link to comment Share on other sites More sharing options...
xmaxgohx Posted April 23, 2008 Share Posted April 23, 2008 Details please Quote Link to comment Share on other sites More sharing options...
cutebird75 Posted April 23, 2008 Author Share Posted April 23, 2008 Hello every body! I am not very genious in programming. I am working on a online system. I have my connection file in "home/config/connection.php" directory. Now I am accessing this file through include ('../connection.php') on first level and include('../../connection.php') on second level. I have to mention all this in each file. but the problem is that if I have to change my directory structure or relocate files to a new place then I will have to change path manually in all files. if there is any specific solution to solve this problem.please tell me about it in datail. Thanks alot. Please tell me in detail 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.