Page template for node type in Drupal

Page template for node type in Drupal (at least 6.x) is not part of the core. You need to nibble a little with template. php and add the following code:

< ?php
function themename_preprocess_page(&$variables) {
if ($variables['node']->type != "") {
$variables['template_files'][] = "page-node-" . $variables['node']->type;

Be careful to correct the $variables according to your naming convention in the themename_preprocess_page function header. Also, in case you didn’t know, you need to replace “themename” with… your theme name…sssh!

You can then create PAGE templates for your node types with the naming: page-node-nodetype.tpl.php.

This is relevant for …

Drupal, drupal 6.x

Post a comment