Hi all,
I am trying to use a php breadcrumb script on my site, and was able to get the following code working except for the folders that are inside other folders.
No problem: http://root.com/folder/
PROBLEM: http://root.com/folder/deeperfolder/ –> this is creating link to http://root.com/deeperfolder/
Can anyone take a look at this code and tell me what I am missing?
Thank you!!
function breadcrumbs($separator = ' » ', $home = 'ホーム') {
$path = array_filter(explode('/', parse_url($_SERVER, PHP_URL_PATH)));
$base = ($_SERVER ? 'https' : 'http') . '://' . $_SERVER . '/';
$breadcrumbs = Array("$home");
$last = end(array_keys($path));
foreach ($path AS $x => $crumb) {
$title = ucwords(str_replace(Array('.php', '-'), Array('', ' '), $crumb));
switch ($title) {
case "Hawaiistudy": $title = "ハワイ留学"; break;
case "English": $title = "ハワイ語学留学"; break;
case "Iie": $title = "IIE"; break;
case "Icc": $title = "ICC"; break;
case "Package1": $title = "IIE滞在付パッケージ3"; break;
}
if ($x != $last)
$breadcrumbs[] = "$title";
else
$breadcrumbs[] = $title;
}
return implode($separator, $breadcrumbs);
}
?>
= breadcrumbs() ?>