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

 

 

 

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.

 

 

  • 2 weeks later...

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.