Return to Snippet

Revision: 36784
at November 26, 2010 12:31 by resting


Initial Code
/**
 * 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();
}

Initial URL

                                

Initial Description
Only this portion needed

    // 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;
        }

Initial Title
Drupal page template on nodetype

Initial Tags
template, page, drupal

Initial Language
PHP