elmas156 Posted February 16, 2011 Share Posted February 16, 2011 Hello everyone, This is a fairly simple question, but the explanation of the question isn't... I'll do my best. I have a site where my folders/sub-folders/files are arranged similar to this: _ Root Folder -| Root-IncludeFile1.php | Root-IncludeFile2.php | _ | Sub-Folder 1 -| Sub1-File1.php | |_Sub1-File2.php | _ | Sub-Folder 2 -| Sub2-File1.php | |_Sub2-File2.php | _ |_Sub-Folder 3 -| Sub3-IncludeFile1.php |_Sub3-IncludeFile2.php Hopefully that makes sense to everyone. Anyway, I know that to include a file that is in the root folder in file in a sub-folder, I can do this - include("../includefile1.php"); -but I'm trying to include a file that is in a sub folder in a file that is in another sub-folder. For example, I'm trying to include "Sub3-IncludeFile1.php" in "Sub-File1.php" I'm lost on this because I can't get it to work. I'm not getting any error messages except to say that the variables located in the file that should be included are not found. I've tried to do this: include("http://www.mysite.com/Sub-Folder3/Sub3-IncludeFile1.php"); and it doesn't work. Can someone please point me in the right direction? Thanks in advance for your help. Quote Link to comment https://forums.phpfreaks.com/topic/227902-including-files-from-other-directories/ Share on other sites More sharing options...
KevinM1 Posted February 16, 2011 Share Posted February 16, 2011 include('../Sub-Folder3/Sub3-IncludeFile1.php'); The '..' in the path means "Move up one level." Quote Link to comment https://forums.phpfreaks.com/topic/227902-including-files-from-other-directories/#findComment-1175158 Share on other sites More sharing options...
elmas156 Posted February 16, 2011 Author Share Posted February 16, 2011 Um... that was too easy ;-) Thanks Nightslyr. Quote Link to comment https://forums.phpfreaks.com/topic/227902-including-files-from-other-directories/#findComment-1175162 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.