3

How do I set the breadcrumbs for a view page with arguments? I've used the "User: username" argument, and the following PHP Code as default argument, but it doesn't work:

$breadcrumb[] = l('Home', NULL);
$breadcrumb[] .= l('Our Team', 'team');
drupal_set_breadcrumb($breadcrumb);
1
  • please tag your question with the version of drupal you are using (and also views)
    – wiifm
    Commented Jun 1, 2011 at 21:24

1 Answer 1

1

I believe when you are creating a view that has an argument you can the opportunity to set a breadcrumb from within views itself.

Substitutions will also be available based on the arguments present.

For example, if you view is

/blogs/2011

Where blogs is the path to the page, and 2011 is the argument, you could set the breadcrumb of the page with the argument to be:

%1

This would leave breadcrumbs that would look like:

Blogs > 2011
6
  • I already did that, but it returns no breadcrumbs at all :( Commented Jun 2, 2011 at 3:27
  • Don't suppose you are messing with hook_breadcrumb()? You will be able to do this without touching that hook
    – wiifm
    Commented Jun 3, 2011 at 0:01
  • I only use this in template.php: function phptemplate_breadcrumb($breadcrumb) { if (!empty($breadcrumb)) { return '<div class="breadcrumb">'. implode(' → ', $breadcrumb) .'</div>'; } } does it interfere with views arguments? Commented Jun 3, 2011 at 1:45
  • You may want to check the menu settings for the views display at "/blogs".
    – donquixote
    Commented Aug 15, 2013 at 14:36
  • Also, I think views only builds a breadcrumb from all but the last item. E.g. if you visit the page /blogs/2011/05/22, then the breadcrumb will only be Blogs > 2011 > 05, without the last item. See drupal.org/node/1919456#comment-7439094
    – donquixote
    Commented Aug 15, 2013 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.