Hello all, I have a shop with categeories sub categories and products and i wondered if anyone had any ideas how i could go about creating a breadcrumb trail based on this and not using the only method i can find online, which is using the folder structure. Does anyone have any tutorials or know of any sites that could help? thanks all
Working on the same problem on a WAMP installation -- Windows-Apache-MySql-PHP/Perl -- I came up with the following breadcrumb script in PHP: $server = $_SERVER["SERVER_NAME"]; $originalpath = $_SERVER["PHP_SELF"]; $urlbase = "http://".$server; $roottitle = "Home"; $seperator = " > "; $ignore = "Home"; $path = explode ("/", $originalpath); $totalelements = count ($path); printf("<a href=\"%s\">%s</a>", $urlbase, $roottitle); for($number=1; $number<$totalelements ; $number++) { $urlbase = $urlbase . "/" . $path[$number]; $path[$number] = str_replace("___", "_&_", $path[$number]); $path[$number] = str_replace("_", " ", $path[$number]); $path[$number] = str_replace("~", "?", $path[$number]); $path[$number] = str_replace(".php", "", $path[$number]); $path[$number] = ucwords($path[$number]); if ($path[$number] != $ignore) { printf("%s<a href=\"%s\">%s</a>", $seperator, $urlbase, $path[$number]); } } Code (markup):