EagerWolf Posted December 26, 2006 Share Posted December 26, 2006 I've got problems with including files from directory...structure:/dir1 dir1-1 file1/dir2 file2In file2 in dir2 I include file1 in dir1. In file1 I want all files in dir1-1 to be included in file1. Can you help me with that... 10x for your help! Link to comment https://forums.phpfreaks.com/topic/31901-php-include-files-from-directory/ Share on other sites More sharing options...
craygo Posted December 26, 2006 Share Posted December 26, 2006 You have to have your includes in reference to where the main script is running from.If your main script is file2 and you want to include file1[code]include("../dir1/file1.php");[/code]now inside of file1 you want to include something in dir1-1 you still have to go from where file2 is. So since file1 is running from file2 your include in file1 would be[code]include("../dir1/dir1-1/file.php");[/code]Ray Link to comment https://forums.phpfreaks.com/topic/31901-php-include-files-from-directory/#findComment-148054 Share on other sites More sharing options...
EagerWolf Posted December 26, 2006 Author Share Posted December 26, 2006 10x... I made it for one file :)How can I include all files in dir?$path = <MyProperDIR>$handle = opendir($path);while (false!== ($file = readdir($handle))) {include('options/'.$file);}closedir($handle); Link to comment https://forums.phpfreaks.com/topic/31901-php-include-files-from-directory/#findComment-148057 Share on other sites More sharing options...
EagerWolf Posted December 27, 2006 Author Share Posted December 27, 2006 No one knows?Must be something with foreach or what? Link to comment https://forums.phpfreaks.com/topic/31901-php-include-files-from-directory/#findComment-148346 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.