Jump to content

Including files from other directories.


elmas156

Recommended Posts

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/227902-including-files-from-other-directories/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.