Custom breadcrumbs for Drupal 7

Warning: this is a bit of a hack methinks.

A site I'm working on contains a mixture of pages, views nodes and taxonomy results depending on the type of content.  I was having problems getting it to display the correct breadcrumb for this mix of types of content.  The Menu Breadcrumb won't do the trick as not all my pages are on the menu, especially those that are nodes.  I also tried the Custom Breadcrumb module, but it didn't do the trick for me and had quite a cumbersome user interface to boot. 

I therefore decided to do it in code, which involves creating a new file in your theme called ''breadcrumb.tpl.php''.  This file overrides the ''theme_breadcrumb()'' function found in ''includes/theme.inc'':

Here's my version of breadcrumb.tpl.php:

<?php
/* hacking the breadcrumbs to get the naviation we want
 */

if (!empty($breadcrumb)) {
  print '<span class="breadcrumb">';

  // split the path into an array, trimming off the leading '/'
  $dirs = preg_split('/\//', ltrim($_SERVER['REQUEST_URI'],'/'));
 
  if (isset($dirs[2])) {
    switch($dirs[1]) {
    case 'library':
    case 'library-categories':
      array_push($breadcrumb, '<a href="/installers/library/">Library</a>');
      break;
    case 'announcements':
    case 'news-categories':
      array_push($breadcrumb, '<a href="/installers/announcements/">Announcements</a>');
      break;
    case 'stories':
      // not required: breadcrumb comes from menu
      break;
    case 'photos':
      // not required: breadcrumb comes from menu
      break;
    case 'scheduler':
      // do nothing
      break;
    break;
    default:
      error_log('TODO: implement 3rd level breadcrumb trails for ' . $dirs[1]);
      break;
    }
  } else {
    switch($dirs[1]) {
    case 'announcements':
      array_push($breadcrumb, 'Announcements');
      break;     
    case 'library':
      array_push($breadcrumb, 'Library');
      break;
    case 'performance':
      array_push($breadcrumb, 'Performance');
      break;     
    case 'photos':
      array_push($breadcrumb, 'Photo Share');
      break;     
    case 'stories':
      array_push($breadcrumb, 'Stories');
      break;     
    default:
      error_log('TODO: implement 2nd level breadcrumb trails for ' . $dirs[1]);
      break;
    }
  }
  print implode(' &raquo; ', $breadcrumb);
  print '</span>';
}