Video tutorials and Online Training
Unlimited Access
Video Tutorials
Video Available as Flash

Bookmark Us

Bookmark Website 
Bookmark Page 

User login

Recent comments

Navigation

Creating custom breadcrumbs for a certain node type

Here's a quick code snippet that shows you how you can create custom breadcrumbs for a certain node type. This code would reside in your template.php theme file.

 

<?php
function MYTHEME_preprocess_page(&$variables)
{
    if (
$variables['node']->type == 'MYNODETYPE')
    {
       
       
$links = array();

       
// creating a link to the home page
       
$links[] = l('Home', '<front>');

       
// here's how you could add a link to a taxonomy page
       
$vid = 2;
        foreach (
$variables['node']->taxonomy as $k => $v)
        {
            if (
$v->vid = $vid)
            {  
               
$links[] = l($v->name, 'taxonomy/term/' . $v->tid);
                break;
            }
        }
       
       
// yet another link
       
$links[] = l('Some Other Link', 'SOMEOTHERLINK');

       
// lastly, overwrite the contents of the breadcrumbs variable in the page scope
       
$variables['breadcrumb'] = theme('breadcrumb', $links);
    }
}
?>

NOTE: if you were adding this code to a module, you could use the drupal_set_breadcrumb() function to do the same functionality.

2 comments

 
Elodie wrote 8 weeks 2 days ago

Gamefly ps3

Hello. If the only prayer you ever say in your whole life is "thank you," that would suffice. Help me! Help to find sites on the: Gamefly ps3. I found only this - gamefly deals. However, i was experienced about how not sailing movies would tell in my time, gamefly. Titles for received, item kids, gamefly. Thanks :confused:. Elodie from Vatican.

 
Tanya wrote 25 weeks 2 days ago

Cosmetic dentist az

Hi all. Sorrow was like the wind. It came in gusts.
I am from Guatemala and , too, and now am writing in English, give please true I wrote the following sentence: "Maintain the southeast roots as for the equipment or the expense."

Thanks :o. Tanya.

Add your comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.

Videos Search