I hate drupal, and because I don’t think anybody else should suffer so much stress over something as simple as breadcrumbs, I give you this. Working, logical breadcrumbs with virtually no configuration.

A few notes:

  • I say logical, I mean this in reference to the person using the site. I know drupal has many breadcrumb modules available but documentation is scarcer than a well designed drupal site (See how bitter drupal has made me!) and none of them did what I wanted.
  • I only needed breadcrumbs on the forum. If you were to use this method on a whole site, you would end up with a lot of if statements plus countless other headaches. But then I’m pretty sure that if you run Drupal through google translate it translates as ‘Headache’ in most languages.

The only configuration required is the vocabulary id. You can find this in Content management > Taxonomy > List
Hovering over the edit vocabulary link will give you a url like this: http://www.domain.com/admin/content/taxonomy/edit/vocabulary/1
You want the number on the end.

This was used on a site using the Zen theme. The changes were all made in the /themes/themeName/page.tpl.php file.

<?php
//if we're on a forum node page or in one of the forum 'topics' (taxnonomies)
if (($node->type == 'forum') || (arg(0) == 'forum')) : ?>
<div>
<?php

if(arg(0) == 'node' && arg(3) == '') {
// If we're on a node page, work out the taxonomy id for it
$terms = $node->taxonomy;

foreach($terms as $topic) {
//replace the 1 with your vocabulary id
if($topic->vid == 1) {
$termId = $topic->tid;
}
}
}
else if(arg(0) == 'forum' && arg(3) == '') {
// For all pages leading up to a node find out the taxonomy id
//replace the 1 with your vocabulary id
$termId = arg(1);
}

if(isset($termId)) {
// use taxonomy id to generate list of parent terms
$forumBreadcrumbs = array_reverse(taxonomy_get_parents_all($termId));

$i = 0;
foreach($forumBreadcrumbs as $crumb) {
$crumbAlias[] = strtolower(str_replace(' ', '-', $crumb->name));

$crumbs .= ' &rsaquo; <a href="/forums/';
foreach($crumbAlias as $crumbUrl) {
$crumbs .= $crumbUrl.'/';
}
$crumbs .= '">'.$crumb->name.'</a>';
$i++;
}
}

echo '<div><a href="/Membership">Membership</a> &rsaquo; <a href="/forum">eForum</a>';

if(isset($crumbs)) { echo $crumbs; }
if(isset($node->title)) { echo ' &rsaquo; '.$node->title; }

echo '</div>';

#print $breadcrumb;

?>