(Tips) Customize Entire Page Template Based On Content Type
Tips : Customize Entire Page Template Based On Content Type
Today I needed to add a new candidate page.tpl file based on node-type. I found this code snippet and modified it slightly.
function phptemplate_preprocess(&$vars, $hook) { switch ($hook){ case 'page': // Add a content-type page template in second to last. if ('node' == arg(0)) { $node_template = array_pop($vars['template_files']); $vars['template_files'][] = 'page-' . $vars['node']->type; $vars['template_files'][] = $node_template; } break; } return $vars; }
Courtesy : Tech.forumone.com
- guru's blog
- Login to post comments
![Drupal-6-Book-[Building Powerful and Robust Websites with Drupal 6].jpg](http://www.drupalranch.com/images/Drupal-6-Book-[Building%20Powerful%20and%20Robust%20Websites%20with%20Drupal%206].jpg)