note 30556 added to reserved.variables
| From: | vlad dot neosurge dot net at rack1 dot php dot net | Date: | Fri, 21 Mar 2003 22:27:57 +0000 |
| Subject: | note 30556 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45622@lists.php.net to get a copy of this message | ||
If you're having problems getting PHP to just output the filename and not the whole path, this
function might work for you:
function filename() {
$host = $_SERVER['PHP_SELF'];
$i = strlen ($host);
while (($stop!=1) and ($i>=0)) {
if ($host[$i] != "/") {
$new = $host[$i] . $new;
$i--;
} else $stop=1;
}
$new = explode ('.', $new);
return $new[0];
}
It returns just the filename, without the path or any slashes or the extension. I used it to
automatically output the page name as a header on the page in a template.
--
http://www.php.net/manual/en/reserved.variables.php
http://master.php.net/manage/user-notes.php?action=edit+30556
http://master.php.net/manage/user-notes.php?action=delete+30556
http://master.php.net/manage/user-notes.php?action=reject+30556