custom node template ignored in sub themes

John Gentilin - March 18, 2009 - 09:00
Project:Drupal
Version:7.x-dev
Component:theme system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Drupal 6.9, views 6.x-2.3

I created a sub theme of marinelli in a sibling directory... Then for my event content type I wanted to
create a custom node template, so I made a copy of the node.tpl.php in the marinelli dir as node-event.tpl.php
in my sub theme directory... After clearing my cache, the system was still using the default template to render
the Event nodes. Later I discovered that if I moved my custom node template to the marinelli directory, then
the custom template was picked up..

This is different from my custom views template, when I create custom templates in the views subdirectory
of my sub theme and rescan the template files, the correct template is picked up from my sub theme..

#1

JDSaward - March 25, 2009 - 08:31

I was experiencing the same difficulty with a sub-theme of Acquia Marina.

I found that once I duplicated the default node.tpl.php file from the Acquia Marina directory, into my sub-theme directory, then the node-type-specific file (in my case node-biblio.tpl.php) is picked up from the sub-theme.

That is, in the sub-theme directory you need a node.tpl.php file as well as node-event.tpl.php.

#2

John Gentilin - March 25, 2009 - 11:50

JDSaward , thank you for the tip... your solution worked for me too...

although to pull node.tpl.php into my sub theme takes a chunk out of the significance
of having a base theme.. might as well take a copy of my base theme and edit that..

-John G

#3

NikLP - April 21, 2009 - 17:51

This is a limitation of the phptemplate engine system under Drupal 6. It may be fixed in Drupal 7, I'm not sure.

#4

DamienMcKenna - June 20, 2009 - 20:05

While some of this can be simplified by using symlinks, it is a bug, makes subthemes definitely less useful, and needs to be fixed.

#5

turadg - September 2, 2009 - 23:20
Title:custom node template not selected for sub themes.» custom node template ignored in sub themes

I agree with Damien. Any chance this will be fixed in D7?

In the meantime, at least some mention of this in the docs would be helpful. I got here from some helpful comments, but this gotcha should be in the main text.

http://drupal.org/node/225125

#6

recidive - October 29, 2009 - 21:06
Project:PHPTemplate» Drupal
Version:HEAD» 8.x-dev
Component:Template Defaults» theme system

I don't know if this was fixed in Drupal 7 but this is certainly in the wrong project.

Is this a bug or a feature request? If it's a feature, I think it's too late for 7, if it's wasn't fixed.

#7

DamienMcKenna - October 30, 2009 - 13:45

This is definitely a bug.

#8

recidive - November 4, 2009 - 13:18
Version:8.x-dev» 7.x-dev

Ok, moving to 7.x to see if this is acceptable there or if this happened to be fixed already.

 
 

Drupal is a registered trademark of Dries Buytaert.