drupaldrupal-6taxonomybreadcrumbsdrupal-panels

Override taxonomy pages with panels and provide taxonomy-based breadcrumb trail for nodes


I have a page where nodes are categorized using a base taxonomy (let's say "species" -> animal -> mammal -> ape).

  1. I want to override taxonomy pages with panels
  2. I also want to make sure all nodes get a nice breadcrumb based on the default taxonomy

I have solved #1 and #2 successfully separately, but cannot get them to play together.

For #1 the best solution I have found is activating "Taxonomy term template" in /admin/build/pages). An excellent guide can be found at http://drupaleasy.com/blogs/ultimike/2010/10/taxonomy-term-pages-steroids-using-panels-views

For #2 both the Custom Breadcrumbs module (with the Custom Taxonomy Breadcrumb sub module) and the Taxonomy Breadcrumbs. Unfortunately both methods hijack the same hook used by #1 and in doing so disables #1.

How can I achieve both goals simultaniously? Thanks a lot!


Solution

  • For #2, you can use Custom Breadcrumbs. I'm not sure about version 6.x-1.x, but I can confirm that 6.x-2.0 works fine. What you need to do is to:

    However, the custom breadcrumb is built after the panels, so you can't actually use it in the panel. But you can print it in page.tpl.php, outside the panel.

    EDIT:

    Seems like Custom Breadcrumbs for Panels had nothing to do with it :)

    It just displayed a very misleading text on the config page ("Use taxonomy breadcrumbs for panels"). After some more research, it turned out that it works when panels had a smaller weight then custom_breadcrumbs_taxonomy (see table system in the database).

    If you really want to display the breadcrumbs in panels, you can do that using this (hack-ish) method:

    (note: my panel is of type page, it's in the content section)

    function abn_preprocess_page(&$vars) {
      $old_breadcrumb = strstr( strstr($vars['content'],'<div class="breadcrumb">'), '</div>', true);
      if ($old_breadcrumb) {
        $old_breadcrumb .= '</div>';
        $vars['content'] = str_replace($old_breadcrumb, $vars['breadcrumb'], $vars['content']);
      }  
    }