I'm having a problem where enabling node_breadcrumb causes template selection to fail. My story nodes should be using the page-story.php.tpl template, but when node_breadcrumb is enabled, the story nodes are displayed with page.php.tpl. Any ideas why this would be happening?

I'm wondering if the following snippet in my template.php is being overridden:

function phptemplate_preprocess_page(&$vars) {
 	// Add additional template suggestions
	if ($vars['is_front'] != 1) {
	    $vars['template_files'][] = 'page-' . $vars['node']->type;	
	}	
}

It seems that $vars['node']->type is empty when node_breadcrumb is enabled.

Comments

edhel’s picture

$vars['node'] is empty as since "menu system" believe that current menu item was changed.

You can fix this problem by change your template.php. Add this line before your code:

if (arg(0) == 'node' && is_numeric($nid = arg(1))) $vars['node'] = node_load($nid);
if ($vars['is_front'] != 1) {
...
talesa’s picture

Status: Active » Fixed

Thank you, that fixed it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.