tcorbeil Posted March 21, 2007 Share Posted March 21, 2007 Me again... is there a way to get just the url? for instance if I have an address such as Domain Name/Oilers/oilers.html in every instance I do $path = $_SERVER['SCRIPT_NAME']; I get /Oilers/oilers.html If i just want /Oilers/ with the file running name at the end, how would I go about? Thanks. T. Quote Link to comment Share on other sites More sharing options...
per1os Posted March 21, 2007 Share Posted March 21, 2007 You can use split or try $_SERVER['DOCUMENT_ROOT']; If you setup a phpinfo(); somewhere you can view what the server variables have in store and see which to use. Or do print_r($_SERVER); Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted March 21, 2007 Author Share Posted March 21, 2007 Thanks Frost. I tried print_r($_SERVER); and seen all of the info.. none of the switch variable would give the path without the file running at the end.. can you elaborated on the split idea? Could I also not use a rtrim up until the first '/' it encounters? Thanks. T Quote Link to comment Share on other sites More sharing options...
per1os Posted March 21, 2007 Share Posted March 21, 2007 <?php list(,$dir) = split("/", $_SERVER['SCRIPT_NAME']); print $dir; // should print "Oilers" ?> Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted March 21, 2007 Author Share Posted March 21, 2007 Frost your a genius! Thanks Man! T. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.