Built a new Drupal site a couple of weeks ago.. I've managed to override the following:

"views-view.tpl.php"
"views-view-field.tpl.php"
"views-view-fields.tpl.php"
"views-view-unformatted.tpl.php"
"page-front.tpl.php"
"page-user.tpl.php"

However, when I try to override any content types, (e.g. "page-node-some-content-type.tpl.php") or try to override some other files for other modules ("galleria.tpl.php", etc..) nothing happens. I've cleared the cache (via "Performance" and through my browser) dozens of times, to no avail..

Can someone help me out? I'm pulling my hair out..

Comments

gbrands’s picture

Hi Modernaut,

Have you tried using the Devel module and it's template suggestions feature? It will show you a list of possible templates that are used to create the page output (essentially, which files you can create to override the output). See Working with template suggestions (http://drupal.org/node/223440).

Alternatively, you can check the following post to see if it helps you out, Page templates depending on node type (http://drupal.org/node/249726). From this post it looks like all you need to do is change the file name of your tpl.php file to page-node-some-content-type.tpl.php.

Hope this helps

modernaut’s picture

Hi gbrands,

Thank you for this. Sorry about that typo up there, that's supposed to be "page-node-some-content-type.tpl.php" (Edited it). I did that, to be sure, and cleared cache in performance and on the browser, yet I cannot override the templates.

For the other files, note that, per instructions in a module's readme, I've been told to override templates as instructed, to no avail.

At any rate, I'll fire up devel and have a look.

Bahlool’s picture

Hi, I'm having the same problem, as in I'm not able to create a custom page template for books content type.

I'm using a subtheme of Bartik under Drupal 7. The file I created was: page-book.tpl.php . The theme devel module shows html.tpl.php where I think it should show page.tpl.php

gbrands’s picture

Do you have both page.tpl.php and page-book.tpl.php in your theme directory? Don't forget to clear your cache too.

Bahlool’s picture

Yes I cleared the cache. Drupal 7 doesn't require the base template file to be present in the same directory.:
See: http://drupal.org/node/225125

Anyways, I've tried with and without, but it didn't help.

rookiewriter’s picture

Howdy,
found out that you need two hyphens (--) in the name for the template. I.e. node--contenttype.tpl.php
once I did that, no problem!

carlwenrich’s picture

Where did you find this?

glombus’s picture

http://drupal.org/node/190815

The Default templates: section specifies that you need the double hyphen to indicate "a more targeted override"