Download & Extend

Add explanation about blocks not appearing on 404 pages

Project:CustomError
Version:6.x-1.1
Component:Documentation
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:403 error, 404, block, blocks, custom, error

Issue Summary

It's not obvious why blocks are shown on 403 pages but not on 404 pages. It would be very useful (and save support requests!) if this was mentioned in the docs with a link to the 404 Blocks module.

Comments

#1

Second that. How can I get my blocks to reappear on a 404?

#2

Nothing since? Did anyone figure out a way to display block on a 'page' that does not exist? Could you use contexts?

#3

I have found a solution with the 404block module. It works great with CustomError but needs some configuration if you are using the Context module to display your blocks, etc.

In my case I am using context to display various blocks for various regions, so I have no regular blocks assigned to regions, but this will also display any blocks when a 404 is invoked. Since contexts (at this time) cannot match a php expression I decided to set my block in admin/build/block and only show them when a php function return true.
Here is the code from the 404block module slightly modified:

<?php
if (strpos(drupal_get_headers(), '404 Not Found') !== FALSE) {
   
// Show all regions.
   
return TRUE;
  }
?>

Now I have my '404' blocks configure the drupal way and all other shown via the context module. Hope this helps others

nobody click here