Drupal Templates By Node ID

By default, Drupal will let you define a template called node-bork.tpl.php, which is a template for all nodes of type “bork.” That’s pretty handy, but what if you want a template for a specific node id? What I want to be able to do is define a template called node-4.tpl.php, which would be the template for the node with node id 4. Here’s how.

In your template.php file, add this:

function phptemplate_preprocess_node(&$vars) {
  $vars['template_files'][] = 'node-'. $vars['nid'];
}