The include path goes something like ./../../folder/to_incude.html depending on how many folders deep a file using the incude file is located. Is there a way to have this be set for all include statement so that where ever the file is the include path will always be the same. So if a file is located 6 folders deep the path will be the same as a file located in the root? Ian
Hi Ian, Yes this is possible, but it would be a security issue. You want to include a PHP script starting at the top of the folder hierarchy then search through the sub-folders until the include file has been found. This could be a security issue as you never know which one it is going to include as "someone" may place an include file in the root folder which does malicious activities. You'll need a function which uses recursion to scan through the entire directories starting at the root and then iterate through the files and folders within the current folder. I think you'll find the following pseudo code helpful: searchDirectory(mydirectory); function searchDirectory(mydirectory) for each file in directory if file is include file then include_once file exit end if end for for each file in directory if file is directory then searchDirectory(file) end if end for end function Theres probably a more efficient way of doing this. Regards, acplus
include get_ini("doc_root") . "/path/to/file/from/root"; Will include the correct file every time no matter where in the hiearchy you may be (note, I may have misspelled the doc_root attirbute, if so, look for the correct spelling in yout php.ini file - I don't have on ehandy to verify...)