Hi everyone!

Does anyone know how to access the $node variables within the phptemplate_breadcrumb function?
I am using this code already:

<?php
function phptemplate_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb)) {
    $breadcrumb[]=drupal_get_title();
    return '<div class="breadcrumb">'. implode(' » ', $breadcrumb) .'</div>';
  }
} 
?>

But I would like to filter node by content type...
I have tried different ways to access it, but I don't really speak php fluently...
Things that I tried: global $node, $node, vars['node'].......etc...

Thanks!

Comments

nevets’s picture

There is not always a node when viewing a page in Drupal. From what you have I am wondering if a theme preprocess function might not be a better place for your code. Do you care to expand on what you are trying to do?

You might also want to check out the Node Breadcrumb and Custom Breadcrumbs modules.

mathis’s picture

Hi,

In fact I have a photographie (pictures) content type where each node is a picture. I use taxonomy for the categories, and taxonomy breadcrumb for the breadcrumb...

It works perfectly while the user navigates between taxonomy pages because the title of the page is the taxonomy term. But on node pages it gives me a correct breadcrumb in a 'taxonomy way' but it lacks the name of the picture (to be consistent with the rest of the website).

So I am trying to add the page title to the breadcrumb, but only for photographie type... And if possible, I would rather do it with a simple override function than by installing a new module...

By the way I am sure that it is a node because I use a node-photographie.php.tpl to theme it.

And for the preprocess function... maybe you could tell me more!

Thanks!

mathis’s picture

Also I have seen this code on the forum, but it doesn't seem to work for me...

<?php
/**
*  Alters the breadcrumb display to show an '>' as the separator
* 
*/
function phptemplate_breadcrumb($breadcrumb) {
       
        global $node;
       
        if (!empty($breadcrumb)) {
         
            if ('blog' == $node->type && arg(0) == 'node') {
        
            }
            else {}
        
... ...
           
              return '<span class="breadcrumb">You are here: '. implode(' > ', $breadcrumb) .'</span>';
        }
}
?>