Created
November 26, 2010 02:50
-
-
Save resting/716214 to your computer and use it in GitHub Desktop.
Drupal page template on nodetype
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Override or insert PHPTemplate variables into the templates. | |
*/ | |
function _phptemplate_variables($hook, $vars) { | |
if ($hook == 'page') { | |
// Add page template suggestions based on node type, if we aren't editing the node. | |
if ($vars['node'] && arg(2) != 'edit') { | |
$vars['template_files'][] = 'page-nodetype-'. $vars['node']->type; | |
} | |
if ($secondary = menu_secondary_local_tasks()) { | |
$output = '<span class="clear"></span>'; | |
$output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n"; | |
$vars['tabs2'] = $output; | |
} | |
// Hook into color.module | |
if (module_exists('color')) { | |
_color_page_alter($vars); | |
} | |
return $vars; | |
} | |
return array(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The only important part...
// Add page template suggestions based on node type, if we aren't editing the node.
if ($vars['node'] && arg(2) != 'edit') {
$vars['template_files'][] = 'page-nodetype-'. $vars['node']->type;
}