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.
you can create a variable $directory = '../../' and use include($directory.'connection.php'); so when you change the directory structure, you will asign a new value to $directory and ...done
If I have to include (for example) a file called 'include_this.php' which is located two directories down and then up into a directory called 'config', I use: include( dirname( __FILE__ ) . '/../../config/include_this.php' ); This also helps for when there are problems with including files in different directories that then want to include files in other, different directories and so on...