note 43387 deleted from function.count by nlopess
| From: | nlopess@php.net | Date: | Sat, 19 Jun 2004 13:25:43 +0000 |
| Subject: | note 43387 deleted from function.count by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71346@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster at melchior dot us
----
Not sure if this is the best way to do something like this or not but this will return however many
'../' things are needed to get to the base dir. I find it useful for links or something
that you have a in sub directory...
$base_url = dirname($HTTP_SERVER_VARS['PHP_SELF']);
$array = explode('/', $base_url);
$subs = count($array) - 2;
$i = 0;
$sub = '';
while($i < $subs) {
$sub .= '../';
$i++;
}
If there's an easier and less of a processful way to do this, let me know. :-)