Array Question
I am using the following array and function in the template for my website. It works great, but I want to to be better. I would to make it so the last item displayed looks differently than the others, but I have been unable to figure out how to distinguish the last item.
When displayed, the crumbs look like:
SITENAME » RANDOM » ITEM
I would like ITEM to look differently. Can anyone tell me how to modify the last ITEM?
When displayed, the crumbs look like:
SITENAME » RANDOM » ITEM
I would like ITEM to look differently. Can anyone tell me how to modify the last ITEM?
// CRUMBS ARRAY
$crumbs = array(
array( "RANDOM", "RANDOM_URL" ),
array( "ITEM", "ITEM_URL" )
);
// CRUMBS FUNCTION
function breadCrumbs($crumbs) {
if ( count($crumbs) > 0 ) {
$spacer = " » ";
$breadCrumbs = "SITE_NAME\n";
foreach( $crumbs as $crumb ) {
if ( count($crumb) == "2" ) {
$breadCrumbs .= "$spacer$crumb[0]\n";
}
}
echo "\n";
echo "\n";
echo $breadCrumbs;
echo "\n";
echo "\n";
}
} 