Jump to content

Recommended Posts

Im using XAMPP at the moment

 

and my applicatin im making is in a folder in the htdocs folder where all my files are read from. I notice when im php scripting if I put any files into another folder with in my main folder it wont load the page. so when I want to load a .php file from a script do i need to add more then just go to this .php file?

 

I tried adding folder/*****.php but that didnt work

 

I want to use multiple folders so its more organized

hope someone can help me out with this

Link to comment
https://forums.phpfreaks.com/topic/252668-using-folders-in-mysql/
Share on other sites

I just realize another problem now since im adding folders

 

 

If I have a header going to folderA/folderB/file.php

 

and while im reading that file if i have any php include files in the script it wont read it from folder B

 

guess there is no way around that?

Yes, there is.  Specify an absolute file path.

 

Includes will always read according to the called script.  So, if you have scriptA in folderA that includes a file in folderB, that includes another file from folderB.  PHP will not find this file if it is passed a relative file path, because PHP will be looking in the directory that scriptA is residing in (folderA).

 

To get passed this, you must specify an ABSOLUTE FILE PATH.

 

include(dirname(__FILE__) . '/myincludedfile.php'); //will include a file in the same directory as the current file.
include(dirname(__FILE__) . '/folderB/myincludedfile.php'); //will look on folder down for the file.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.