Orionsbelter Posted September 28, 2008 Share Posted September 28, 2008 hi i have a file called included.php which is in the includes folder. i used to used /include/included.php when the folder was in the folder with the file but now am in a different folder, i could just make a copy of included.php and put it in that folder but i would like to know how to do this i think its something to do with ../ but not sure can some explain it thanks Link to comment https://forums.phpfreaks.com/topic/126140-how-to-include-a-file-that-is-in-another-folder/ Share on other sites More sharing options...
Dogrox Posted September 28, 2008 Share Posted September 28, 2008 doode just use one dot './include/include.php' that should work from the folder your already in. I Know I am having similar peroblems Link to comment https://forums.phpfreaks.com/topic/126140-how-to-include-a-file-that-is-in-another-folder/#findComment-652263 Share on other sites More sharing options...
Orionsbelter Posted September 28, 2008 Author Share Posted September 28, 2008 but isn't the . for each folder for the sever so if its everything is in a folder called website which is in the domain folder on the sever that would mean it'll be ../ wouldn't it? Link to comment https://forums.phpfreaks.com/topic/126140-how-to-include-a-file-that-is-in-another-folder/#findComment-652265 Share on other sites More sharing options...
Dogrox Posted September 28, 2008 Share Posted September 28, 2008 that all depends on where your trying to call it up from. if the file that has the include statment in it.. is in another SUB folder.,, and the include folder is off root. Like .. www/includes/include.php which is saying ti is form the root. but the file that you are trying to licude that is in say www/subfolder/filename.ext so you need to go back to root then to includes folder.. then both dots would work! butwhat if the includes folder is in www/subfolder/include/include.php where the file that is calling it up is in the root of that sub folder too then you would use one dot.. that will bring it only back to the subfolder thats what i have been experieinceing. Link to comment https://forums.phpfreaks.com/topic/126140-how-to-include-a-file-that-is-in-another-folder/#findComment-652266 Share on other sites More sharing options...
PFMaBiSmAd Posted September 28, 2008 Share Posted September 28, 2008 Make your life easy, just use an absolute file system path - include($_SERVER['DOCUMENT_ROOT'] . '/your_path_to_file/your_file.php'); Link to comment https://forums.phpfreaks.com/topic/126140-how-to-include-a-file-that-is-in-another-folder/#findComment-652334 Share on other sites More sharing options...
Dogrox Posted October 8, 2008 Share Posted October 8, 2008 sorry i posted my rerply in the wrong post!. sorry about that! Link to comment https://forums.phpfreaks.com/topic/126140-how-to-include-a-file-that-is-in-another-folder/#findComment-659809 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.