[eluser]Unknown[/eluser]
Well here goes :
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
if ( ! function_exists('breadcrumb'))
{
function breadcrumb($pages, $separator = '', $endlink = FALSE)
{
$depth = count($pages);
$i = 0;
$output = '<ul id="breadcrumb">';
foreach ($pages as $url => $label)
{
$i++;
if($depth > $i)
{
$output .= '<li>'.anchor($url, $label).'</li>';
if($separator != '')
{
$output .= '<li class="separator">'.$separator.'</li>';
}
}
else
{
if($depth == $i && $endlink == TRUE)
{
$output .= '<li>'.anchor($url, $label).'</li>';
}
else
{
$output .= '<li><span>'.$label.'</span></li>';
}
}
}
$output .= '</ul>';
return $output;
}
}
You can use it by feeding it a Key/Value (URL / Label) array from your controller :
Code:
$data->crumbs['my/url'] = 'label';
$data->crumbs['my/other/url'] = 'otherLabel';
and call it in your view with
Quote:<?php echo breadcrumb($crumbs); ?>
Optional paramaters are 'separator' to chose the separator symbol and 'endlink' to determin wether the last element is a link or not