Hi, I'm having a bit of difficulty with breadcrumbs, and I wondered if anyone could help:

The site is quite hierarchical and uses a mixture of CCK content types, Categories and Views to provide the navigation structure.

I've carefully constructed consistent URLs with Pathauto that reflect the structure of the site, so I was wondering whether there was a module or snippet or something that could force breadcrumbs to take their structure from the url?

I've tried using taxonomy_context, but that is not a complete solution only works on parts of the site that uses the taxonomy to provide structure, not on parts that use views or Pathauto.

For example, the page at:
http://79.170.40.163/actionspace.org/about-us/who-we-are/staff-members/g...

That with taxonomy_context displays the breadcrumb:

Home › Staff profiles › Staff members

I want it to display:

Home › About us › Who we are › Staff profiles › Staff members

as per the URL.

How can I get it to do this? Is it possible?

Basically, what I want is a Pathauto for breadcrumbs, or a way of modifying Pathauto for doing breadcrumbs as well.

Any thoughts would be much appreciated.

Comments

Anonymous’s picture

You should look at the Custom Breadcrumbs module. It can probably do exactly what you want.

http://drupal.org/project/custom_breadcrumbs

-Mike Goodwin
http://www.not2us.net
http://www.redleafmedia.com

Anonymous’s picture

Hi Mike, thanks for your suggestion.

I've already tried Custom Breadcrumbs and it doesn't do what I want.

It's fine for breadcrumbs on nodes, but it can't do breadcrumbs on Views. Plus I couldn't make it form the right URLs when nodes had spaces in the title.

arh1’s picture

lately i seem to always end up providing my own implementation of theme_breadcrumb to match all the quirks of my site's urls... it seems pretty messy/inefficient though -- i'd love to hear of any better solutions out there...

something like this:

function mytheme_breadcrumb($breadcrumb) {
  $tier = array();  // for the bc's we want to insert

  $query = $_REQUEST['q'];
  $query_bits = explode('/',$query);

  // remove existing bc's as needed...

  // define 'url', 'path', 'menu_item', 'link' for new bc's as needed here...

  // add any new breadcrumbs
  if ($tier[0]['link'] && $tier[0]['link'] != $breadcrumb[1]) {
    array_shift($breadcrumb);  // temporarily remove Home
    rsort($tier);
    foreach($tier as $bc) {
      array_unshift($breadcrumb, $bc['link']);
    }
    array_unshift($breadcrumb, l(t('Home'), ''));
  }

  if (empty($breadcrumb)) {
    return '<div id="breadcrumb">&nbsp;</div>';
  }
  else {
    return '<div id="breadcrumb">'. implode(' &gt; ', $breadcrumb) .'</div>';
  }
}
Anonymous’s picture

Interesting. I've implemented your code, and it works much better than before, though it seems to work on some pages, but not at all on others.

I've found something else which looks promising:

http://drupal.org/node/93500

It works better than anything I've seen so far, but it doesn't work for sites in subfolders, and it also shows the current page (do not want).

So, I'm getting breadcrumbs which look like this:

Home [not a link] » Actionspace.org [link to site] » Artists [fine] » Artist Tutors [fine] » Liz Emtage [current page, not a link]

Closer, but no cigar just yet.

Evolver’s picture

Have you checked out Menu Breadcrumb

http://drupal.org/project/menu_breadcrumb

It has some interesting options and builds the breadcrumbs based on pathauto.

Doh sorry it's only for 6.