3

I've created a page node for an about page. I've checked the node id of the node which is 11. I've created a file named page--node--11.tpl.php in my theme directory containing some test html but it's not overriding the standard page.tpl.php file. I've also tried using the following file names: page-node-11.tpl.php page-node--11.tpl.php

I've cleared the cache but still no luck.

What am I missing?

1
  • Is there anything in template.php that could be causing the issue? Specifically check THEME_preprocess_page or THEME_preprocess_node if they exist. Commented Oct 21, 2013 at 19:42

1 Answer 1

7

According to Drupal 7 Template (Theme Hook) Suggestions it should be page--node--11.tpl.php (note the double dashes):

page--[front|internal/path].tpl.php base template: page.tpl.php The suggestions are numerous. The one that takes precedence is for the front page. The rest are based on the internal path of the current page. Do not confuse the internal path to path aliases which are not accounted for. Keep in mind that the commonly-used Pathauto module uses path aliases.

The front page can be set at "Administration > Configuration > System > Site information." In Drupal 6, at "Administrator > Site configuration > Site information." Anything set there will trigger the suggestion of "page--front.tpl.php" for it.

The list of suggested template files is in order of specificity based on internal paths. One suggestion is made for every element of the current path, though numeric elements are not carried to subsequent suggestions. For example, "http://www.example.com/node/1/edit" would result in the following suggestions:

  • page--node--edit.tpl.php
  • page--node--1.tpl.php
  • page--node.tpl.php
  • page.tpl.php

Also see page.tpl.php in the Drupal API documentation for more information.

10
  • I've tried that as well, cleared out the cache and still the same thing - page.tpl.php is being called.
    – Wazzag
    Commented Oct 21, 2013 at 19:25
  • The URL is: <mysite.com>/?q=node/11 and my file is named node--11.tpl.php
    – Wazzag
    Commented Oct 21, 2013 at 19:25
  • 1
    @beth, this would be correct if the result desired is that the actual content of node/11 be formatted differently in the content region of the standard page. if however, a custom page layout itself for displaying node/11 is desired, then page--node--11.tpl.php is correct. Assuming D7.
    – Jimajamma
    Commented Oct 21, 2013 at 19:35
  • Thanks jimajamma, it's the latter I'm after. However, neither files are overriding the defaults.
    – Wazzag
    Commented Oct 21, 2013 at 20:03
  • 1
    I've got it working, I disabled the modules theme developer and libraries and it started using my page--node--11.tpl.php! I expect it was the Theme Developer module? Many many thanks for your help and patience everyone!
    – Wazzag
    Commented Oct 22, 2013 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.