Forum Moderators: coopster
<p id="crumbs"><span class="bold">You are here:</span> <a title="Home Page" href="/">Home</a> > <a href="/photos/">Photos</a> > <a href="/other/">Other</a></p> <p id="crumbs"><span class="bold">You are here:</span> <a title="Home Page" href="/">Home</a> > <a href="/photos/">Photos</a> > <a href="/photos/other/">Other</a></p> <?php
// CREATE BREADCRUMBS
// Get current url and process it:
$current = $_SERVER['REQUEST_URI'];
// Replace underscores and dashes with spaces
$current = str_replace("_", " ", $current);
$current = str_replace("-", " ", $current);
// Create array with parts as separated by a slash
$currentArray = explode("/",$current);
$breadCrumbHTML = '<a href="/" title="Home Page">Home</a>';
// Loop through the array and print out the results
for( $i=1; $i < count($currentArray) -1; $i++) {
// capitalize the first letter of each word in the section name
$crumbName = ucwords($currentArray[$i]);
// rebuild the navigation path
$newTrail = $currentArray[$i] . '/';
// build the HTML for the breadcrumb trail
$breadCrumbHTML .= ' > <a href="' . $newTrail . '">' . $crumbName . '</a>';
}
?>
<p id="crumbs"><span class="bold">You are here:</span> <?php echo $breadCrumbHTML; ?></p> [edited by: tedster at 3:16 pm (utc) on Apr 4, 2010]
[edit reason] switch to example.com - it can never be owned [/edit]