Drupal - node.tpl.php override broken

Kevin's picture

[b]Q:[/b] Help! I have overridden node.tpl.php for my content type (like node-my_type.tpl.php) in my drupal theme but it is not working, it is having no effect at all, none of my changes are being displayed when I view nodes of that type!

[b]A:[/b] There are a few reasons why drupal will not pick up on your new node template, the most common is just that the cache is out of date and needs to be cleared, but if your theme doesn't have a node.tpl.php file drupal won't use your overridden template either.

By far the most common cause of drupal not picking up on your new node template is that its cache needs to be cleared first - there are many ways to clear drupal's theme cache but one way to do it is to navigate to Admin / Performance and hit the 'Clear cached data' button.

If that doesn't work:

1.) Check that your overridden node tmplate is in the correct place, it should be in your active theme's directory.

2.) Check that your overridden node template file is named correctly, it should be named like node-your_content_type_name.tpl.php.

3.) And here's the one that wasted me a load of time yesterday ---> Check that your theme has a [b]node.tpl.php[/b] file, if it hasn't it will happily inherit the 'node' module's one, but it _won't_ pick up on your overridden template!!! So if there is no node.tpl.php in your theme's folder, copy one in from this directory /modules/node/ and remember to clear your cache again...

I hope this helps someone wasting tonnes of time like I did yesterday!

Share this post: 

Recent Work

Some of Ireland's biggest brands use Pride Design to Design, Build, Manage, Market and Maintain their websites.

Website design for St.Patricks Credit Union in Dublin, Including Loan Calculators.

Website design and development for a step by step wedding and other stationary ordering website f

New website designed and developed for Cork's newest café, which is based in Merchants Quay in Co

New Website design for Pain Relief clinic based in Cork City.

Website for a busy Dublin city centre pub.

We redrafted the Ballymaloe house website to modernise the look and feel of the site and to also

We revamped the website for the Ballymaloe Cookery School.

We revamped the Cully & Sully website onto Drupal.

Rachel Allen was brought up in Dublin and left home at eighteen to study at the world-famous Ball

Clóna Dairy Products are a Dairy Company based in Clonakilty, Co. Cork, since 1919.

Project Arts Centre is Ireland’s leading centre for the presentation and development of c