This is more of a support request as I have experienced this twice on Drupal 5 to Drupal 6 upgrades. The issue is that, for some reason the theme system starts to ignore theme layouts such as node-blog.tpl.php. I also have tested using the contemplate.module and tried to implement changes to node layout through that module's interface without success.

Very odd issue and have only seen it on a couple of installations and thought it was worth reporting. I will post more information here as I find it but if anyone has run into this before, do let me know.

Comments

shane birley’s picture

Okay, so, I have turned off the theme, removed the files and cleared the cache. When I put the theme back on the server (and checked they were correct using vi) I started receiving these error messages. I removed the node.tpl.php file just to test to see the node-blog.tpl.php would load and this is what happened:

include(./sites/example.com/themes/theme_example/node.tpl.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /drupal_6_install/includes/theme.inc on line 1011.

and

include() [<a href='function.include'>function.include</a>]: Failed opening './sites/example.com/themes/theme_example/node.tpl.php' for inclusion (include_path='.:') in /drupal_6_install/includes/theme.inc on line 1011.

This error vanishes when I replace node.tpl.php with anything. No matter the formatting of the node.tpl.php file, the theme uses the base format. Still looking.

shane birley’s picture

If I remove block.tpl.php or page.tpl.php from the theme directory the same error above occurs for those files. This is also affecting core themes if I mess with them, I get the same errors.

shane birley’s picture

Status: Active » Closed (fixed)

After tinkering with things, I decided that one thing I had not tried was to rename the theme folder. Magically, it worked. Who knew... closing.

shane birley’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Active

I am re-opening this as I have found another theme (fresh installation of Drupal 6 and fresh brand new basic theme) that is ignoring files such as:

node-[type].tpl.php

The files are not loading in favour of the default node.tpl.php format. I had encountered this earlier and thought it was just a weird behaviour that I had caused, but this time with a new Drupal installation and a from-scratch theme (that has been working for a few weeks just fine) has started to display the same issue.

I have cleared the theme cache (registry) and even dumped the entire theme in order to see where the issue is coming from.

ainigma32’s picture

Title: Upgrading to Drupal 6 from Drupal 5 Breaks Templates in PHPTemplate (Sorta) » Theme ignores node-[type].tpl.php
Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

Try having both the normal node.tpl.php and the node-[type].tpl.php in the theme's folder.

Please post back how that works out for you.

- Arie

shane birley’s picture

I created a new node.tpl.php with the default with the default layout (from http://api.drupal.org/api/file/modules/node/node.tpl.php/6/source) and posted it into my test theme, cleared the caches, and the problem appears to vanish.

This is similar to my first encounter (without the errors, however). So, it would seem the theme engine is not loading the defaults from the engine itself (which I recall is supposed to happen and appears to happen for a while) and then at some point decides to only load the defaults and ignore any theme generated content.

ainigma32’s picture

Status: Postponed (maintainer needs more info) » Fixed

Good to hear the errors went away. I'm not sure what's happening on your end but you might be able to figure it out by using the Devel module.
I can recommend it especially if you are developing your own theme.

I'm setting this to fixed for now, feel free to change that if you think that is wrong.

- Arie

shane birley’s picture

I think there is still a bug somewhere but until I determine if it is within Drupal core or on our server (although, the problem doesn't appear at all in our Drupal 5 installations) I agree that it should be set to "fixed". I will gather up any additional information I can - but, for now, having templates in the theme directory isn't a bad work around. If you can think of anything, do let me know.

I did go through the last couple of days of the server error logs and there is nothing to indicate that PHP is tanking or having any problems. I have run out of places to look!

jakew’s picture

Version: 6.9 » 6.7
Status: Fixed » Active

Back to active because I'm having this problem too...

In this case, it's working fine on my local working copy (using MAMP on Mac OS X). Uploading it to my host causes it to start ignoring node-[type].tpl.php ... even with a fresh upload (re-tar the directory for the local copy, upload it, expand it on the server, export the database from local and import it on the server).

I don't know what would possibly be different on the server versus localhost, but apparently there's something...

jakew’s picture

Wow, it was a capitalization issue.

Renaming node-Event.tpl.php to node-event.tpl.php fixed it.

ainigma32’s picture

Status: Active » Fixed

Ok back to fixed re #8

- Arie

shane birley’s picture

I think there is a relationship here with the template suggestions methods but I can't see where.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

shane birley’s picture

Status: Closed (fixed) » Needs review
clemens.tolboom’s picture

xurizaemon’s picture

Status: Needs review » Closed (fixed)

The reports above appear to agree with the behaviour as documented on Themeing Nodes by Content Type in the handbook. That document says,

NOTE: When using phptemplate node-[type].tpl.php suggestions, there must also be an original node.tpl.php template present in your theme directory or the template suggestion is ignored.

This is also the case for subthemes. Just copy the parent themes node.tpl.php into your subtheme folder and refresh the theme cache.

If you are experiencing this issue, please verify that you have both a node-TYPE.tpl.php *and* the default node.tpl.php in your theme folder.

Marking this closed, feel free to re-open if you are experiencing this bug and the documented fix (also mentioned by ainigma32 in the comments above) does not resolve the issue.

tran_tien’s picture

Version: 6.7 » 6.22
Priority: Normal » Critical
Status: Closed (fixed) » Active

I have both file node.tpl.php and node-type.tpl.php in themes folder, rebuild theme registry but still not work.

damien tournoud’s picture

Status: Active » Closed (won't fix)

I'm sorry, but we don't handle support requests in the Drupal Core issue
queue as a regular practice. There are several support options listed if
you click on "Community and Support" at the top of Drupal.org, which
will take you to: http://drupal.org/community.

There you can find out about the Drupal IRC channels, and the Forums,
which are our two main support mechanisms in the Drupal community.

Good luck with your issue!