Page 1 of 1
including files
Posted: Sun Oct 29, 2006 10:48 am
by tommy1987
I have tried to include some pages, which are severel directories below the current. However I dont know how to do this, I thought of using the full http:// URL but it didnt work.
This problem is simple and I just need someone to show me how to do it.
Thanks very much..
Posted: Sun Oct 29, 2006 11:45 am
by aaronhall
When using functions that take a file path as an argument, a leading forward slash ("/") tells the function that you are referring to an absolute path as opposed to a relative one. When you pass a path without that forward slash, the function will try to look for a directory relative to the directory from which you are calling include(). An absolute path refers to a resource with respect to the root of the directory structure. You can find the root path to your account's root directory directory by calling $_SERVER['DOCUMENT_ROOT']. Start with that root path, and work your way to the file you are looking for (and don't forget the leading forward slash).