Posted by Visard on November 24, 2011 at 4:53pm
I'm a novis to Omega and Drupal, but how to make the 'breadcrumbs' work under 'forums' ?
In 'ZEN' (and my subtheme of that) for example this works just fine, but then I switch to my Omega subtheme it don't. One way I have tried is to copy/paste Zen's 'function zen_breadcrumb($variables) {' into my subthemes template.php but it will not run. Hope someone can explain how to make it run or an other solution...
Comments
Breadcrumbs are enabled by
Breadcrumbs are enabled by default. You can change settings in the Layout configuration of your subtheme under 'Toggle advanced elements'
Have you renamed the
Have you renamed the function?
Your caches will need to be cleared for the function to be used from the template.php.
It needs to be called themename_breadcrumb()
The various $zen_variables will need renaming & you'll need to check that the custom theme has the same variables. Install devel module & use it's variable editor to view the variables for your subtheme.
Also use…
dsm($variable, "Var name");
…to print the variable via the devel module to be sure that the code is running.
I guess there may be modules that will allow you to specify breadcrumbs via the GUI, but I don't have any experience with them.
The other thing to remember
The other thing to remember is that a Zen subtheme could be accessing settings or features that were setup in the parent theme. So have a look at the main zen template.php.
Solved it...
Thank you drew !
You pushed me in right direction - I'm now close to that I wanted :-)
I include the code for my subtheme's 'template.php' -
maybe someone else can reuse it...
/-----------------------/
function MYTHEME_alpha_process_page(&$vars) {
$theme = alpha_get_theme();
$vars['title'] = $theme->settings['toggle']['page_title'] ? $vars['title'] : NULL;
$vars['breadcrumb'] = $theme->settings['toggle']['breadcrumb'] ? MYTHEME_alpha_breadcrumb($vars) : NULL;
}
function MYTHEME_alpha_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];
if (!empty($breadcrumb)) {
$trailing_separator = $title = '';
$item = menu_get_item();
if (!empty($item['tab_parent'])) {$title = check_plain($item['title']);
} else {
$title = drupal_get_title();}
if ($title) {$trailing_separator = ' : ';}
if ($title) {
if (stristr( $breadcrumb, $title) ) {
$spos = strrpos($breadcrumb, '» ' . $title);
if ($spos) {
$breadcrumb = substr_replace($breadcrumb, ': ' ,$spos - 1, 2);
}
$trailing_separator = $title = '';
}
}
return $breadcrumb . $trailing_separator . $title;
}
return '';
}
/-----------------------/
Omega breadcrumb issues
I, too, have had problems with Omega breadcrumbs, and am in the process of ditching Omega entirely, as an easier step than getting the breadcrumbs in Omega to work (which I've tried many things over several days of mucking about). I can confirm that my override functions are doing something (ie, I can change the separator or inject other text into the breadcrumb), but the breadcrumb still doesn't behave properly.
No matter what I've tried, I can't get it to show the hierarchy (parent nodes) in the breadcrumbs; I only get "Home" and the current page - the latter only because I've added it in a themename_breadcrumb() function - otherwise it would just be "Home", and as a result doesn't display the breadcrumb at all!
When I switch to another theme (ie, Bartik), the breadcrumbs work fine, showing home, followed by all parents, then the current (unlinked) page name.
Just an idea - when I started
Just an idea - when I started up with drupal I had a simular problem due to the breadcrumb was added as a block.