View Single Post
Old 06-18-2008, 02:42 AM   #5 (permalink)
delayedinsanity
The Gregarious
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Cana'derr
Posts: 653
Thanks: 24
delayedinsanity is on a distinguished road
Default

There's a lot of different ways you could go about it. I think he's referring to a method of using the URI to build a breadcrumb, not one based on any database. Off the top of my head,

PHP Code:
function crumby ($szCurPage$szSeperator='»'$szRoot=NULL) {
    
    
$aPath explode('/'$_SERVER['REQUEST_URI']);

    
$szTrail = (isset($szRoot)) ? 'http://'.$szRoot.'/' 'http://'.$_SERVER['HTTP_HOST'].'/';

    
$szReturn ' <a href="'.$szTrail.'">Home</a> '.$szSeperator;        

    
$intLoop count($aPath)-1;

    for(
$i=1$i $intLoop$i++) {

        
$szTitle ucwords(str_replace('_'' '$aPath[$i]));
        
$szTrail .= $aPath[$i].'/';

        
$szReturn .= ' <a href="'.$szTrail.'">'.$szTitle.'</a> '.$szSeperator;
    }

    
$szReturn .= ' <strong>'.$szCurPage.'</strong>';

    return 
$szReturn;
}

echo 
crumby('You Are Here!'); 
This method wouldn't work well with unreadable URI's, but it's a start.
-m
delayedinsanity is offline  
Reply With Quote