Page 1 of 1

file path [solved]

Posted: Wed May 30, 2007 3:33 am
by ekosoftco
using

Code: Select all

$_SERVER['PHP_SELF']
is there a way to take off the file extension, the .php part?
i want to be able to show the path the viewer has went through so far, but make it like
/folder/page
instead of /folder/page.php
and a way to make the "/" a "->" instead?
:)
thanks

Posted: Wed May 30, 2007 4:04 am
by ekosoftco
never mind, i got it. :)
if anyone wants or needs to know how, here ya go.
these filenames are examples, but its what i use just to let whoever know...

Code: Select all

<?php
	$lineArray = explode('.', $_SERVER['PHP_SELF']);
	$sku = trim($lineArray[0]);
	$skuu = str_replace('/', ' -> ', $sku); //replace / by ->
	echo $skuu;
	?>

Posted: Wed May 30, 2007 8:43 am
by CoderGoblin
pathinfo with potentially basename would probably result in a more robust solution. (what happens with file called my.file.php with your solution).