I have a page (Articles & Reviews) that uses Views to display two lists of nodes, tagged with the terms Articles and Reviews, respectively. Currently, when viewing the individual nodes, the breadcrumbs just show ...
Home
... but I'd like it to show ...
Home >> Resources >> Articles & Reviews
What is the best way to accomplish this?
In digging through some modules in core to get some ideas, I thought the following approach might work. Create a new module that implements a nodeapi hook for view, with something like ...
// if node has the "Articles" or "Reviews" taxonomy term (how do I check for this?) $breadcrumbs[] = l(t('Home'), NULL); $breadcrumbs[] = l(t('Resources'), 'resources'); $breadcrumbs[] = l(t('Articles & Reviews'), 'resources/ articles_and_reviews'); drupal_set_breadcrumb($breadcrumbs); $breadcrumb = theme('breadcrumb', drupal_get_breadcrumb());
Am on on the right track, or is there a better way?
Thanks,
Ray
On Sep 12, 2006, at 8:33 PM, Ray Zimmerman wrote:
// if node has the "Articles" or "Reviews" taxonomy term (how do I check for this?) $breadcrumbs[] = l(t('Home'), NULL); $breadcrumbs[] = l(t('Resources'), 'resources'); $breadcrumbs[] = l(t('Articles & Reviews'), 'resources/ articles_and_reviews'); drupal_set_breadcrumb($breadcrumbs); $breadcrumb = theme('breadcrumb', drupal_get_breadcrumb());
And what is the difference between the above and the 'set_menu_location' approach, such as the following from blog_view() in blog.module?
$breadcrumb[] = array('path' => 'blog', 'title' => t('blogs')); $breadcrumb[] = array('path' => 'blog/'. $node->uid, 'title' => t ("%name's blog", array('%name' => $node->name))); $breadcrumb[] = array('path' => 'node/'. $node->nid); menu_set_location($breadcrumb);
- Ray