Jump to content

Archived

This topic is now archived and is closed to further replies.

Guest convention

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

Recommended Posts

Guest convention
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!

Share this post


Link to post
Share on other sites
[code]<?php
$arr=explode("/",$_SERVER['SCRIPT_NAME']);
echo $arr[count($arr)-2];
?>[/code]

Orio.

Share this post


Link to post
Share on other sites
Guest convention
Thanks for the help, Orio, however I get a "Parse error: parse error, unexpected T_VARIABLE" error on line 3...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.