Breadcrumb with current page


Display current page as the last item in breadcrumb

Get raw version
  1. function YOURTHEMENAME_breadcrumb($breadcrumb) {
  2. if (!empty($breadcrumb)) {
  3. return '<ul class="breadcrumb"><li class="breadcrumb-item breadcrumb-previous">' .
  4. implode('</li><li class="breadcrumb-item breadcrumb-previous">', $breadcrumb) .
  5. '<li class="breadcrumb-item breadcrumb-current">' . drupal_get_title() . '</li></ul>';
  6. }
  7. }

Example output (extra line returns and indentation added for readability)

Get raw version
  1. <ul class="breadcrumb">
  2. <li class="breadcrumb-item breadcrumb-previous">
  3. <a href="/">Home</a>
  4. </li>
  5. <li class="breadcrumb-item breadcrumb-previous">
  6. <a href="/">Articles</a>
  7. </li>
  8. <li class="breadcrumb-item breadcrumb-current">
  9. I like cereal
  10. </li>
  11. </ul>


xwing's picture

I'm attempting to use this in Sasson for Drupal 7. This is printing in UL LI format, and shows the current page, but the breadcrumb only consists of 'Array'.
It doesn't matter how deep the navigation is, the breadcrumb only shows 2 levels - Array > *currentpagetitle

xwing's picture

Got it. My page.tpl.php was using:
<?php print $breadcrumb; ?>
Should be something similar to:
<?php print theme('breadcrumb', drupal_get_breadcrumb()); ?>

lolmaus's picture

This was supposed to be used with D6.