what i'm trying to do here, in my php code below i have to set file name manually and i want to make it some how it grabds the file name automatically but without file extention
here's part of my code where i want to get file name
$Pages = array(
'clothes' => 'Clothes',
'shirt' => 'shirt',
'this-shirt' => 'This Shirt'
);
where it says "this-shirt" is file name and i want it to be set automatically instead of i write it down everytime i create a page. also here's full code
<?php
$Pages = array(
'clothes' => 'Clothes',
'shirt' => 'shirt',
'this-shirt' => 'This Shirt'
);
$path = $_SERVER["PHP_SELF"];
$parts = explode('/', $path);
if (count($parts) < 2) {
echo("home");
} else {
echo ("<a href=\"http://domain.com\">Home</a> » ");
for ($i = 2; $i < count($parts); $i++) {
if (!strstr($parts[$i], ".")) {
echo("<a href=\"");
for ($j = 0; $j <= $i; $j++) {
echo $parts[$j] . "/";
};
echo("\">" . str_replace('-', ' ', $Pages[$parts[$i]]) . "</a> » ");
} else {
$str = $parts[$i];
$pos = strrpos($str, ".");
$parts[$i] = substr($str, 0, $pos);
echo str_replace('-', ' ', $Pages[$parts[$i]]);
}
}
}
hope you get the idea. thanks