breadcrumbs not displaying correctly for views I'm pretty new to the world of drupal so I'm hoping this will be a quick fix.

Anyhow here's the situation:
my breadcrumbs work correctly when hitting a node for example when i go to "contact" it prints out home > contact.  Now I have a view and when I go there things look ok. I go to events and it prints out home > events > view all. When I go to a subview like "tech events" however it spits out home > events > events > view all.

The code below is what is currently in place so I was wondering how to alter it to handle views or if anyone could point me to a good solution.

thank you

my code:

function custom_breadcrumb($variables) {
  $currentTitle = "";
  $trail = menu_get_active_trail();
  $currentNode = array_pop($trail);
  if( $currentNode ){
    $currentTitle = $currentNode['title'];
  }

  $breadcrumb = $variables['breadcrumb'];
  if (!empty($breadcrumb)) {

    $output = '&lt;ul class="breadcrumb"&gt;&lt;li&gt;';
    $output .= implode('&lt;/li&gt;&lt;li class="breadcrumb-seperator"&gt;&lt;!--&amp;raquo;--&gt;&lt;/li&gt;&lt;li class="breadcrumb-seperator-border"&gt;&lt;/li&gt;&lt;li&gt;', $breadcrumb);

    if( $currentTitle ){
      $output .= '&lt;/li&gt;&lt;li class="breadcrumb-seperator"&gt;&lt;!--&amp;raquo;--&gt;&lt;/li&gt;&lt;li class="breadcrumb-seperator-border"&gt;&lt;/li&gt;&lt;li class="active"&gt;';
      $output .= $currentTitle;
    }
    $output .= '&lt;/li&gt;&lt;/ul&gt;';

    return $output;
  }
}


any help would be awesome guys. thank you.
Okay so it still needs some work to be a little more generic but this basically handles the case. It checks to make sure that the content-type is not a node we check to see if there's an additional argument and append that to the breadcrumbs. if it is a node we just print out hte breadcrumb trail checking to make sure that we don't repeat things. If you use a page jump, fragments, or redirects you might get a repeat, i.e. home > stories > stories.  So here it is.

function custom_breadcrumb($variables) {
  $currentTitle = "";
  $trail = menu_get_active_trail();
  $currentNode = array_pop($trail);
  if( $currentNode ){
    $currentTitle = $currentNode['title'];
  }

  $breadcrumb = $variables['breadcrumb'];
  if (!empty($breadcrumb)) {
    $lastCrumb = NULL;

    $output = '&lt;h2 class="element-invisible"&gt;' . t('You are here') . '&lt;/h2&gt;';

    $output .= '&lt;ul class="breadcrumb"&gt;&lt;li&gt;';

  for ($i = 0; $i &lt; count($breadcrumb); $i++) {
    $curCrumb = strip_tags($breadcrumb[$i]);
    if ($i == 0) {
      $output .= $breadcrumb[$i];
      $lastCrumb = strip_tags($breadcrumb[$i]);
    } elseif (strpos($breadcrumb[$i], $lastCrumb) === false) {
      $output .= '&lt;/li&gt;&lt;li class="breadcrumb-seperator" data-test="testing"&gt;&lt;!--&amp;raquo;--&gt;&lt;/li&gt;&lt;li class="breadcrumb-seperator-border"&gt;&lt;/li&gt;&lt;li&gt;' . $breadcrumb[$i];
      $lastCrumb = strip_tags($breadcrumb[$i]);
    }
  }

  if (arg(0) != 'node' ) {
    $output .= '&lt;/li&gt;&lt;li class="breadcrumb-seperator"&gt;&lt;!--&amp;raquo;--&gt;&lt;/li&gt;&lt;li class="breadcrumb-seperator-border"&gt;&lt;/li&gt;&lt;li class="active"&gt;';
    $output .= arg(1);
  } elseif( $currentTitle ){
    $output .= '&lt;/li&gt;&lt;li class="breadcrumb-seperator"&gt;&lt;!--&amp;raquo;--&gt;&lt;/li&gt;&lt;li class="breadcrumb-seperator-border"&gt;&lt;/li&gt;&lt;li class="active"&gt;';
    $output .= $currentTitle;
  }
  $output .= '&lt;/li&gt;&lt;/ul&gt;';

  return $output;
  }
}