look, that was my guide
Different page templates for different content types Description
Once upon a time there was a drupal themer working on a dark and stormy night, he sat there wondering how to make different page templates for certain content types on his site. He thought about how the drupal template system seems to be missing this for some reason... Suddenly, he had a vision! Like a ray of light bringing, hope and happiness down from the heavens!! oh yes!! Resolution
<?php // Add additional template suggestions function _phptemplate_variables($hook, $vars) { switch ($hook) { case '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-'. $vars['node']->type; } break; } return $vars; } ?>
This means if you have a content type called event and you want it to have a custom page layout, just copy page.tpl.php to page-event.tpl.php.
got it?
just dump the code into template.php, then make a page template called page-[CONTENT TYPE].tpl.php
and drupal will use that instead
Can this be achieved for node.tpl
Hi,
Can we have different node templates based on the node types. Is this possible in Drupal? Posted by Visitor (not verified) on Thu, 2008-08-21 02:07
As of Drupal 5, just copy your node.tpl.php file to whichever node-CONTENT_TYPE.tpl.php and that template file will be used for theming nodes of that type.
For example, node-event.tpl.php. Posted by Benjamin Melançon on Thu, 2008-08-21 05:41