Return to Snippet

Revision: 47048
at May 31, 2011 08:25 by stewartduffy


Initial Code
/*
 * Function to create breadcrumbs (Even for pods)
 * 
 */
	function loopCrumb(){
	    $url_string = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; 
	    $url_explode = explode("/", $url_string);
	    $i=1;
		$count = count($url_explode);
		
	    foreach ($url_explode as $value) {
	    	if($value != ""){
		        $array = array_slice($url_explode, 0, $i);    
		        $url = implode("/", $array);
				$title = str_replace("-", " ", $value);
				$title = ucwords($title);
				$title = ucwords(strtolower($title));
				if ($i === 1){
					$title = "Home";
				}
		        $crumb = '<a href="http://'.$url.'">'.$title.'</a> > ';
		        echo $crumb;
		        $i++;
	    	}
	    }        
	}

Initial URL

                                

Initial Description
Function to print breadcrumb links

Initial Title
Breadcrumb function

Initial Tags
php, function

Initial Language
PHP