Drupal - node.tpl.php override broken

in

Q: 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!

A: 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 node.tpl.php 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!

BAvetriextsic (not verified)
BAvetriextsic's picture
Thanks for giving

Thanks for giving information

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can use BBCode tags in the text.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.

Pride on FacebookPride on TwitterPride on TwitterPride on Twitter

Join Our Newsletter

* indicates required

Irish Internet Association

finalist.png
phone-number.png