Jump to content


[SOLVED] Help with predefinded variables (displaying current dir).


  • Please log in to reply
2 replies to this topic

#1 Guest_convention_*

Guest_convention_*
  • Guests

Posted 24 August 2006 - 08:28 AM

Hi,

I am wondering what I can put in the variable
$_SERVER[' ']
so the page can display what directory that page is in? For instance, if I put
echo "You are in directory ".$_SERVER['blah'].".";
on a page that is in a directory titled "green", then it would display
You are in directory green.

Any way to do this? Thanks!

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 24 August 2006 - 08:37 AM

<?php
$arr=explode("/",$_SERVER['SCRIPT_NAME']);
echo $arr[count($arr)-2];
?>

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 Guest_convention_*

Guest_convention_*
  • Guests

Posted 24 August 2006 - 09:37 PM

Thanks for the help, Orio, however I get a "Parse error: parse error, unexpected T_VARIABLE" error on line 3...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users