Quick Tip: Theming Custom Node Types with Acquia Marina


As I go through the process of translating my wireframes into CSS layouts, I found a pretty interesting bug/feature with the Drupal 6 theming engine and subthemes. In my case, I was trying to create a node-race.tpl.php for Acquia Marina that contains my custom PHP.

I copied node.tpl.php from the Fusion Core theme into my Acquia Marina theme directory and renamed it node-race.tpl.php. What I should have done was copied it into the Acquia Marina theme directory and kept the name node.tpl.php, and then copied it to node-race.tpl.php for modifications!

The Drupal theming engine should look for node-.tpl.php, node-.tpl.php, and finally node.tpl.php when it renders a node (Hint: Rebuild your theme registry as a first step). With subthemes, Drupal won’t check for the custom node templates if there is no base node.tpl.php in the subtheme directory.

For more, see the Drupal Issue: Themes can’t use node-story.tpl.php without node.tpl.php - marked will not fix for some reason. I need to file this in my blog category “hope-I-can-save-someone-else-fifteen-minutes-of-googling”