if i have a file called gallery.php and its in the /forums/gallery.php directory, i dont want the forums part.
well, i figure it.
if i use: $_SERVER['PHP_SELF']
print $_SERVER['PHP_SELF'];
OUTPUT:
/forums/gallery.php
if i have gallery.php?id=23: $_SERVER['REQUEST_URI']
print $_SERVER['REQUEST_URI'];
OUTPUT:
/forums/gallery.php?id=23
but i only want gallery.php
this is how i did it
i broke it down to an array:
<?
function GetFileName($php_self){
$filename = explode("/", $php_self); // THIS WILL BREAK DOWN THE PATH INTO AN ARRAY
$filename = array_reverse($filename ); // THIS WILL MAKE THE LAST ELEMENT THE FIRST
return $filename[0];
}
echo GetFileName($_SERVER['PHP_SELF']);
?>
function GetFileName($php_self){
$filename = explode("/", $php_self); // THIS WILL BREAK DOWN THE PATH INTO AN ARRAY
$filename = array_reverse($filename ); // THIS WILL MAKE THE LAST ELEMENT THE FIRST
return $filename[0];
}
echo GetFileName($_SERVER['PHP_SELF']);
?>