1

I am using a custom 404 page. I also have a theme installed.

This is what I did:

  1. I created a node 95761 which contains my 404 error page.
  2. I set node/95761 to be my 404 error page I've created a template in my theme node--error.tpl.php
  3. I cleared my cache after uploading node--error.tpl.php to the server.
  4. I've verified that node--error.tpl.php exists on the server and has my custom code in my theme's templates folder.
  5. I go to [mydomain]/pathThatDoesNotExist

Actual result: The contents of node/95761

Expected result: The modified version that is contained in node--error.tpl.php

I also tried node--95761.tpl.php and that doesn't override node/95761 either.

Any ideas why Drupal 7 is not picking up the override and how to fix it?

While we're at it, should the name of the template actually be node--error-404.tpl.php so that it doesn't override 403 or other non-404 errors?

1
  • is 95761 the node ID or a title? templates should be node--{NODE ID}.tpl.php at least in drupal 7. It is different in 6 and 5 - which version of Drupal are you using?
    – Geoff
    Commented Jul 25, 2014 at 20:03

2 Answers 2

1

Have you check this link http://example.com/admin/config/system/site-information. Visit the above link in your site and set the 404 error page for your site.

0

If you have assigned 95761 node id as you error page and its not picking your override.

I think you need to add these lines in your template.php file of your active theme.

function YOURTHEMENAME_preprocess_page(&$variables) {
if ($variables['node']->type != "") {
$variables['template_files'][] = "page-node-" . $variables['node']->type;
  }
}

Hope it will work for you!

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.