Guest convention Posted August 24, 2006 Share Posted August 24, 2006 Hi,I am wondering what I can put in the variable [code]$_SERVER[' '][/code] so the page can display what directory that page is in? For instance, if I put [code]echo "You are in directory ".$_SERVER['blah'].".";[/code] on a page that is in a directory titled "green", then it would display [code]You are in directory green.[/code]Any way to do this? Thanks! Quote Link to comment Share on other sites More sharing options...
Orio Posted August 24, 2006 Share Posted August 24, 2006 [code]<?php$arr=explode("/",$_SERVER['SCRIPT_NAME']);echo $arr[count($arr)-2];?>[/code]Orio. Quote Link to comment Share on other sites More sharing options...
Guest convention Posted August 24, 2006 Share Posted August 24, 2006 Thanks for the help, Orio, however I get a "Parse error: parse error, unexpected T_VARIABLE" error on line 3... 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.