Drupal page template on nodetype


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. /**
  2.  * Override or insert PHPTemplate variables into the templates.
  3.  */
  4. function _phptemplate_variables($hook, $vars) {
  5. if ($hook == 'page') {
  6. // Add page template suggestions based on node type, if we aren't editing the node.
  7. if ($vars['node'] && arg(2) != 'edit') {
  8. $vars['template_files'][] = 'page-nodetype-'. $vars['node']->type;
  9. }
  10.  
  11. if ($secondary = menu_secondary_local_tasks()) {
  12. $output = '<span class="clear"></span>';
  13. $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
  14. $vars['tabs2'] = $output;
  15. }
  16.  
  17. // Hook into color.module
  18. if (module_exists('color')) {
  19. _color_page_alter($vars);
  20. }
  21. return $vars;
  22. }
  23. return array();
  24. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.