I feel like this is an easy answer but google isnt helping on this one right now I need to get the url up to the folder that a script is in so http://www.testing.com/test1/test2/myScript.php in myScript.php, how could I have it echo out http://www.testing.com/test1/test2/ I need this for the paging script I use, any help appreciated =)
Try: echo dirname(__FILE__); PHP: This should output the directory of the script that it resides in. (i.e. /test1/test2/) Jay
If you access this script directly through browser: 1. dirname($_SERVER['SCRIPT_NAME']) will give you /test1/test2 2. prepend yourdomain name and append a slash to make it http://www.testing.com/test1/test2/ If you access your script from within another script (php include) then: 1. dirname(__FILE__) will give you full filesystem path to the directory containg script (like /home/domain/public_html/test1/test2) 2. Strip DOCUMENT_ROOT ($_SERVER['DOCUMENT_ROOT']) from the beginning of the full path. It will leave you with /test1/test2 3. prepend yourdomain name and append a slash to make it http://www.testing.com/test1/test2/ Cybernaut.