Community & Support

node--book.tpl.php not being processed.

With Drupal 7 and the book module. I'm trying to apply a custom
node template file, "node--book.tpl.php" to override the standard
"node.tpl.php" file in the Garland template. I've added "node--book.tpl.php"
to the same directory as "node.tpl.php", and I've modified the
"template_preprocess_node" function in "node.module" to include
the line, "$variables['theme_hook_suggestions'][] = 'node__'. $node->type;"
as pages on the drupal site (http://drupal.org/update/modules/6/7#theme_hook_suggestions_2)
instructs.

But this does not work: the display of a book page still uses
"node.tpl.php" -- not "node--book.tpl.php".

What am I missing?

Comments

Try

node-book.tpl.php and not node--book.tpl.php

I did..

The older docs seem to suggest that
node-book.tpl.php
should do the trick (overriding node.tpl.php for book content)
while the newer writing (that I link to above) suggests it
should be
node--book.tpl.php
Unfortunately, neither works. Is it possible this is a problem
with the latest Drupal 7? Or am I missing something essential?

Steve from InkByte

Node templates look like this

Hi,

When I customize node types for a node it would look like this:

node-pro_whitepapers.tpl.php

I imagine a book would look like:?

node-book.tpl.php

I did an api check for the book, there are different .tpls but I don't think they fit your setup. http://api.drupal.org/api/search/6/book

Also clear your cache in Drupal and as a last resort your browser.

Visit me www.pacificsimplicity.ca | Drupal services & Design, 3d Autodesign and Howtos.