Drupal 6 custom content-type page templates

When developing a Drupal website, you may be interested in having content specific templates, so different kind of pages do not look the same. By default, we can use list of default core templates, but we can adapt it better to meet our needs by modifying template.php file in theme folder (we are assuming we are using PHPTemplate Theme engine). In my case, using an Acquia theme, I noticed it ignored page-content_type.tpl.php templates. I found a solution in the Net, but then page-node-x.tpl.php-like templates stopped to work. An easy workaround is simply adding an extra line for these latter cases:

function phptemplate_preprocess_page(&$vars) { // Add per content type pages if (isset($vars['node'])) { // Add template naming suggestion. It should alway use hyphens. // If node type is "event", it will pick up "page-event.tpl.php". $vars['template_files'][] = 'page-'. str_replace('_', '-', $vars['node']->type); // If node number (nid) is 56, it will pick up preferentially "page-node-56.tpl.php". $vars['template_files'][] = 'page-node-'. $vars['node']->nid; } }

Hope it may help.