Community & Support

How to change "home" text in breadcrumb ?

Hi,
how can I change the "home" txt in generated breadcrumb ?

Thanks,
Brakkar

Comments

Here's how...

Find the following line in menu.inc:

<?php
$links
[] = l(t('Home'), variable_get('site_frontpage', 'node'));
?>

And change 'Home' to whatever:

<?php
$links
[] = l(t('Some name here'), variable_get('site_frontpage', 'node'));
?>

Hope this helps.

bad idea to modify core

It's a bad idea to modify core files b/c it will make upgrading much messier. 2 alternatives:

1. Use the locale module to create your own "language". See http://drupal.org/node/24593 for instructions.
2. Use theming. If you wanted to do something more complicated like, say, getting rid of the Home link altogether, you could override theme_breadcrumb. For example, you could do something like:

function phptemplate_breadcrumb($breadcrumb) {
  if (strip_tags($breadcrumb[0]) == "Home") {
    array_shift ($breadcrumb);
  }
  if (!empty($breadcrumb)) {
    return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
  }
}

I heard that drupal 6 might have hook_something_alters for more things, so possibly in drupal 6, there might be a hook_breadcrumb_alter.

=-=

This handbook page may help as well : http://drupal.org/node/72850 which is where gwen's example comes from, i believe.

How to do this for drupal 6

Hi all,

Sorry, I still can't figure out how to do this in Drupal 6 without modifying the core. I just want to change the text of "Home" to "Library Home".

Can anyone help?

Thanks!
-Tim

=-=

it may be possible with the string overrides.module.

Thanks!

Woot! The String Overrides module totally worked. Many thanks VeryMisunderstood!

-Tim

use theme_breadcrumb()

You could override the theme_breadcrumb() function in your theme's template.php file, adding a line to modify the first link in the $breadcrumb array:

<?php
function YOURTHEME_breadcrumb($breadcrumb) {
  if (!empty(
$breadcrumb)) {
   
$breadcrumb[0] = l('Library Home',NULL);
    return
'<div class="breadcrumb">'. implode(' » ', $breadcrumb) .'</div>';
  }
}
?>

thanks for that

@jeffschuler
thanks for that, worked like a charm at first but then some errors for me:
-white screen of death on login, logout and use of search form
-error: Cannot modify header information - headers already sent ...
-error: session_regenerate_id() ...

solution in this case:
using notepad++ needed to set the template.php format from 'Encode with ANSI' to 'Encode with UTF-8 without BOM' to get rid of the ? in the diamond (visible in ff) and show the >>, though may have avoided this by using ' » ' can't be sure.
'without BOM' is important: http://drupal.org/node/1424

so a long search for a fix, and i needed some help, but this snippet eventually worked well in this case. thanks!

working example

Simple

Go to breadcrumbs module and change it . 3 second :) . joomla 1.5x

nobody click here