Array Question

From: Date: Sun, 02 May 2004 21:54:15 +0000
Subject: Array Question
Groups: php.general 
Request: Send a blank email to php-general+get-185156@lists.php.net to get a copy of this message
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 select ITEM? // CRUMBS ARRAY $crumbs = array( array( "RANDOM", "RANDOM_URL" ), array( "ITEM", "ITEM_URL" ) ); // CRUMBS FUNCTION function breadCrumbs($crumbs) { if ( count($crumbs) > 0 ) { $spacer = " <span style=\"color:#94cf42;font-size:15px;font-weight:bold;\">&raquo;</span> "; $breadCrumbs = "<a href=\"URL/\">SITE_NAME</a>\n"; foreach( $crumbs as $crumb ) { if ( count($crumb) == "2" ) { $breadCrumbs .= "$spacer<a href=\"$crumb[1]\">$crumb[0]</a>\n"; } } echo "<!-- ####################### BREADCRUMBS STARTS HERE ####################### -->\n"; echo "<span class=\"breadcrumbs\">\n"; echo $breadCrumbs; echo "</span>\n"; echo "<!-- ######################## BREADCRUMBS ENDS HERE ######################## -->\n"; } }

« previous php.general (#185156) next »