Purpose

The primary purpose of this module is to provide a simple way to customize the display of specific nodes. It is not intended to overlap functionality that can best be done directly through your theme or with another module. In particular, if you are trying to customize the display of ALL nodes of a particular content type, this is probably best done through your theme (or perhaps with another helper module like Contemplate).

If you have not arrived at this handbook page from the Custom Node Template module page, you may also wish to read the description of the project on the Custom Node Template project page.

Why Use This Module?

In general, this module would most likely be useful for overriding or customizing the display of node on a node-by-node basis or to provide such options to those who don't have access or the ability to customize a theme. It can still be useful for advanced users and developers as well when it is not convenient, feasible, or efficient to customize a theme to achieve the same functionality. For example, one could add some addition code for node template suggestions into the template.php file and add node-NodeID.tpl.php files to a theme. But this isn't not very efficient if you are overriding or customizing the display of a number of nodes in the same way. This module would allow you to add one customized node template into your theme and then select this template for the several nodes in question.

Please also see the Use Cases section at the bottom of this page for additional information to help you decide if this module would be useful.

Installation

Install as usual, see http://drupal.org/node/70151 for further information.

Configuration

Configure user permissions in Administer >> User management >> Permissions >>

custom_node_template module:

- administer custom node templates

Users in roles with the "administer custom node templates" permission will see the node template settings field set on node and content type forms.

FAQ

Please also see the Use Cases section which follows the FAQ section.

Q: How do I use this module?

A: You can specify the use of a specific node template (node.tpl) file when you are creating or editing a node. Under Node Template Settings, you will find a select list of the node templates in your current theme. Simply the select the
one you wish to have used when the node is displayed. You can also specify the node template to be used by default in the Content Type settings. Nodes you create will use this setting as the default unless you choose a different node
template when you create a new node.

Q: How do I add custom node templates?

A: To add a custom node template, simply create an additional node.tpl file and add it to your theme. The format for naming the file should be node-XXXXXX.tpl where XXXXXX is a custom name that you specify. Additional tips and suggestions for naming tpl files can be found in the Help module.

Q: Why would I use this module?

A: This module is probably most useful for customizing the node template to be used on a node-by-node basis. It can also be used to specify a particular node template by content type. However, it is not necessary to do this if you are only using one node template per content type. By default Drupal will load the appropriate node template for the content type if one exists in your theme in the appropriate format for template suggestions. In general, this module would most likely be useful for overriding or customizing the display of node on a node-by-node basis or to provide such options to those who don't have access or the ability to customize a theme. It can still be useful for advanced users and developers as well when it is not convenient, feasible, or efficient to customize a theme to achieve the same functionality.

Q: How is this module different from other modules?

A: There are a number of contributed modules with "template" in the name, but "template" is one of those words that can be used to mean several different things. In the case of this module, "template" relates to template files in a theme. Custom Node Template differs from other modules in a number of ways. A few are more robust and intensive in nature, while this module is intended to be simple to use. However, the primary difference with this module is that it is not strictly related to content types, nor is it intended to be a solution for the display of nodes by content type. There are many ways to customize the display of nodes by content type via theme or other modules.

If you are only interested in customizing the display of nodes by content types - that is, all nodes within a particular content type are to be displayed the same way - then this module is probably not for you. The simplest way to customize the display of all nodes of a content type is to add a node-content_type.tpl.php file to your theme.

Q: Can't I just do this through my theme without this module?

A: You certainly could, technically-speaking. And in some use cases, that would be the better option. For example, if you are only interested in customizing the display of all nodes of one particular content type, this is probably best done through your theme (as described above) or perhaps with another helper module. In such a case, there is really no purpose in using this module. Another example would be if you are trying to override or customize the display of one particular node. In this case, it is probably simplest to add the appropriate code to the template.php file in your theme and then add a node-XXX.tpl.php file (where XXX is the node ID - this is one way to do this). However, if you have several different nodes that you want to display a certain way, this module becomes useful. Adding multiple node templates by Node ID is probably not efficient (and could make for a "bulky" theme).

Q: Are there any suggestions for naming custom node templates?

A: There are some naming schemes you will probably wish to avoid when adding custom node templates to your theme. For example, unless you are doing so deliberately, you will probably not want to name a custom node template file node-4.tpl. Depending on your theme, you may have a preprocess function that adds the Node ID as a template suggestion for Drupal. If this is the case with the theme you are using, Drupal will load the node-4.tpl file for Node/4. If you name your custom node template with this same name, it would work when you choose the node template for a particular node, but it will also cause the same node template to be loaded for Node/4 which you may or may not wish to have happen. As another example, you could include a node template that has a content type in the name of the node template. But if you don't want to have that node template loaded as the default for that content type, the another name would probably be better

Use Cases

The following are a few use cases that may help you to decide if this module would be useful for you.

I want to customize the display of a particular content type
No, this module is not recommended
Display of content type can be done in a theme simply by adding a node-content_type.tpl.php file. Additional code in the theme is not needed. Using this module would not provide any additional functionality.
I want to override the display of one single node
You could use this module, but it would not be extremely useful.
To override the display of a single node, you could add some additional php code to the template.php file in your theme (add node suggestions for Drupal) and then add a node-XXX.tpl.php file where XXX is the Node ID number.
I want to override the display of the entire page
No, this module will not help you.
This module pertains to the display of a node. To customize or override the display of an entire page, you will either want to customize the page.tpl.php file in your theme or use another module.
My site displays post information on nodes, but there are certain nodes where I don't want this to be displayed
This module would probably be perfect for you.
You can add a node template into your theme which does not include the fields for post information (author, date, etc.). Then, in the Node Template Settings for the particular nodes, select this node template and voila!
I'm using a social bookmarking module on my site which is displayed in the links section of my nodes, but I have some nodes "here and there" where I don't want the social bookmarking widget to appear.
This module would probably be perfect for you.
You can add a node template into your theme which does not include the links variable. then, same as the situation above, select this node template in the Node Template Settings for the particular nodes