I am working on a project that will require more than one template for a single node type (I am using the file based template). I can create a bunch of IF statements in my template but that would create a nightmare to manage and I am also not anticipating but three or four different templates. Is it possible to have a different template for different nodes?

Now with that said, Webform (by quicksketch) does just what I am talking about. He adds the nid to the filename. For example. Webform-form-[node id here].tpl.php.

Please let me know.

g

Comments

jrglasgow’s picture

the webform module is using the theme template system built into Drupal. You can do the same thing by not using Content Templates and doing the same thing with the node template that comes with the node module

Copy node.tpl.php form the node module (modules/node/node.tpl.php) into your theme. Then copy the file to node-node_type.tpl.php. Then clear the theme registry.

now your templates are in the theme and you no longer need to use this module.