EZDC
EZDC

Reputation: 682

bread crumbs for views drupal 7

Am working with views and am wondering if there is a way to get the view to update the breadcrumb trail. When on my first view called homme the breadcrumbs are not updated it still just says "home >" as if it is still on the homepage. When I click a post the breadcrumbs update to "Home › Blogs › admin's blog › ". I need it to say Home > Homme > Name of Article, basically what you would expect when going to a blog site or post.

Can I get the view to act like a blog?

Upvotes: 1

Views: 3551

Answers (2)

Carl McDade
Carl McDade

Reputation: 642

Adding this to your template.php file should work with d7 sites:

function theme_breadcrumb($breadcrumb)
{
  if (substr($_GET['q'], 0, 13) == 'news/category') {
    $breadcrumb[] = l('News', 'news/');
  }
  if (count($breadcrumb) > 1) {
    if ($breadcrumb) {
      return '<div class="breadcrumb">'. implode(' &rsaquo; ', $breadcrumb) ."</div>\n";
    }
  }
}

Upvotes: 0

rybosome
rybosome

Reputation: 5136

One option is to try overriding the themeable output generated by the default breadcrumb function.

Assuming you've created your own theme - create a file called template.php at the root of your theme. Create a function named YOURTHEME_breadcrumb, where YOURTHEME is the name of the theme. The HTML returned by this function will be the breadcrumb. Modify the return values as necessary here to get what you want. Consider using Drupal's menu functions to build a more satisfactory breadcrumb.

Check the comments of this API article for more detail: http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_breadcrumb/7

Upvotes: 1

Related Questions