<?php
/**
 * Simple breadcrumb generator
 * 
 * Include at the top of each page where you desire breadcrumbs
 *
 * @author  Paul Bissex <pb@e-scribe.com>
 * @license MIT
 * @version 0.1.1
 */
 
$pathbits explode ('/'$_SERVER['REQUEST_URI']);

function 
crumb ($bits$current)
    {
    
$position array_search ($current$bits);
    foreach (
range (0$position) as $i)
        {
        
$url .= $bits[$i] ."/";
        }
    return 
$url;
    }

foreach (
$pathbits as $pathbit)
    {
    if (!empty (
$pathbit))
        {
        
$url crumb ($pathbits$pathbit);
        
$crumbs[] = "<a href='$url' style='color: #eeeeee'>$pathbit</a>";
        }
    }

if (
$crumbs)
    {
    
$host $_SERVER['HTTP_HOST'];
    
$crumbtrail implode (" / "$crumbs);
    print 
"<div style='background: #222222; color: #eeeeee; padding: 6px'><a href='/' style='color: #ffffff'><b>$host</b></a> / $crumbtrail</div>";
    }
?>