PHP Dynamic Breadcrumb
        Posted  
        
            by Adrian M.
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Adrian M.
        
        
        
        Published on 2010-04-08T11:31:34Z
        Indexed on 
            2010/04/08
            11:43 UTC
        
        
        Read the original article
        Hit count: 334
        
Hello,
I got this code from someone and it works very well, I just want to remove the link from the last element of the array:
//get rid of empty parts
$crumbs = array_filter($crumbs);
$result = array();
$path = '';
foreach($crumbs as $crumb){
    $path .= '/' . $crumb;
    $name = ucfirst(str_replace(array(".php","_"),array(""," "), $crumb));
    $result[] = "<a href=\"$path\">$name</a>";
}
print implode(' > ', $result);
This will output for example: Content > Common > File
I just want a to remove the link from the last item - "File" to be just plain text.. I tried myself to count the array items and then if the array item is the last one then to print as plain text the last item.. but I'm still noob, I haven't managed to get a proper result..
Thank you!
© Stack Overflow or respective owner