views:

37

answers:

1

Hello,

I got this code from someone, it's almost perfect to create a dynamic breadcrumb, but there just a little glitch because it echoes two dividers before the breadcrumb:

$crumbs = explode("/",$_SERVER["REQUEST_URI"]);
foreach($crumbs as $crumb){
    echo ucfirst(str_replace(array(".php","_"),array(""," "),'>' . $crumb));
}

it echoes:

">>content>common>file"

what I want it to look like is

"content>common>1"

and also I will deeply appreciate if someone can tell me how can I add links for all the items in the array except the last one (file)?

Thank you so much everybody, this website really helped me a lot to learn php by examples!

+2  A: 
Tom Haigh
It works, how can I remove the link from the last item? (file)Thanks!
Adrian M.