3

On my site I have configured things so that the home page will appear if the URL doesnt exist. (ie in admin/settings/error-reporting I set a replacement page for the 404 page.)

The problem is that the menu doesnt appear, so if a user lands here he cant use the site properly.

My menu is the 'primary menu' and has been placed in the left sidebar. I dont have any special setting for this block - eg no page 'includes' or 'excludes'.

To help me debug can anyone tell me if this is the expected behaviour or any suggestions for what might have gone wrong?

I'm using Drupal 6.

3 Answers 3

5

Drupal doesn't render the region of your theme that your primary menu is in; there's a module to change this behavior:

On 404 Not Found error pages, Drupal will skip rendering of several pieces of your website for performance reasons. Some of these include:

  1. The "Left" and "Right" regions of your theme.
  2. The "Primary links" block and any other menu links block.*
  3. The Primary links and Secondary links of your theme.*

*Unless you have configured a "Default 404 (not found) page" on admin/settings/error-reporting.

From 404 Blocks module description.

0
1

I think is important to mention this:

Since blocks now appear on 404 pages, but navigational links are still missing, this project is being renamed…

For a Drupal 7 version, see the 404 Navigation project.

0

There s a simple work around. I try to avoid modules for simple things. http://drupal.org/node/129762#comment-228166

Just override theme_page function then call phptemplate_page right after from your template.php file.

Remember to rename "YOURTHEME_page" with the name of your theme.

function YOURTHEME_page($content, $show_blocks = TRUE) {

  // Set additional conditions to change $show_blocks if you want here..
  // The following will always set $show_blocks to TRUE.
  $show_blocks = $show_blocks ? $show_blocks : TRUE;

  // phptemplate_page is what gets called usually but the 
  // theme function allows us to override it with the themes' name.
  // We're calling it directly here so we don't have to copy tons of code.
  return phptemplate_page($content, $show_blocks);
}
1
  • Thanks kantu. In the end I decided on the module solution above as havent yet worked up the energy to figure out how the hooks and overriding stuff works. May 21, 2012 at 10:04

Your Answer

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

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