Internet Unlimited
Argon 1
4751 XC Oud Gastel
T: +31 (0)165 - 33 22 44
F: +31 (0)165 - 33 22 49
When creating useful websites, it's important to get the big things right. But taking care of the small things often enhances design and usability. Breadcrumbs are such things. While not making up for bad design, they help making navigation easier by allowing a quick overview of where someone is at inside the website's hierarchy and quick access to higher site levels.
As Jakob Nielsen puts it:
So breadcrumbs are a navigational tool that...
starts with the homepage and ends with the current page
With Drupal 6 out in the wild for quite some time now, it's too bad the breadcrumbs feature lack the current location. In fact, as people override the default function, people consider the previous level as current.
Consistent breadcrumbs for Drupal 6
To allow for the default breadcrumbs to be themed, put this preprocess function in your template.php...
/**
* Allow themable breadcrumbs
*/
function mytheme_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
foreach($breadcrumb as $value) {
$crumbs .= '<div class="breadcrumb">'.$value.'</div> :: ';
}
}
return $crumbs;
}
To add the current location to them, add this preprocess function (or modify the already existing one)
function phptemplate_preprocess(&$variables, $hook) {
/* Make active page title in breadcrumbs */
if(!empty($variables['breadcrumb'])) $variables['breadcrumb'] = '<div class="breadcrumbs">'.$variables['breadcrumb'].'<div class="breadcrumb current">'.$variables['title'].'</div></div>';
}
Now that's something that will go into our theme framework.
Tell us about your project and we will provide you with a free review or proposal