Jump to content

how to include a file that is in another folder? ../


Orionsbelter

Recommended Posts

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
Share on other sites

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
Share on other sites

  • 2 weeks later...
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.