By nitro322 on
I have the site navigation menu in the left sidebar set to be displayed on all pages. However, if a user navigates to an invalid page, he'll get a "Page not found" page with no menu or sidebar - just the message itself, along with the site title and footer. How do I make the navigation menu/sidebar display on the "page not found" page?
Thanks.
Comments
Fixed It
Well, I gave up on looking for an option to make this work correctly and started digging through the source code instead. I found the function that controls this page display in includes/common.inc:
function drupal_not_found()The bottom of the function includes this line:
print theme('page', $return, FALSE);Removing FALSE from that line makes it display the blocks properly. Easy fix, but it'd really be nice to have a proper option for this instead of requiring code modification. Now I need to remember to change this every time I upgrade Drupal.
Another workaround
Thanks for posting this; I noticed the same problem.
My workaround:
- create a node that includes a "page not found" message AND the links you want. I just added links to /search/node and to the front page, but I'm guessing you could print your entire navigation menu as well.
print menu_tree();(Or something like that. Obviously one would have to supply parameters to indicate which menu, what depth, etc.)- at admin/settings/error-reporting tell drupal to use this node as the "page not found" message
BTW, the "access denied" (403 error page) DOES print the navigation menu by default. Hmmmm. Maybe you should report the lack of menus on the 404 page as a potential bug?
False to True
The bottom of the function includes this line:
print theme('page', $return, FALSE);
Removing FALSE from that line and writhe TRUE insted. If not it woudn work out for me.
regards
Ole Martin
http://www.drupal.no
http://www.drupal1.no
To do this without modifying
To do this without modifying core. Add the following to your template.php file
replace NAMEOFYOURTHEME with the actual name of your theme.
This will make sure blocks are never turned off.
------------------------------------
Ronan - Gorton Studios - http://www.gortonstudios.com/
------------------------------------
Ronan
Founder - NodeSquirrel - https://www.nodesquirrel.com/
Agency Tools Lead - Pantheon - https://www.pantheon.io/
Perfect, this did the trick.
Perfect, this did the trick. I have been wanting a fix for this one for ages!
Custom Zen Theme
Very new to Drupal and PHP. I am having the same issue. I attempted to insert this code fragment into a "custom" Zen theme.
I am trying to insert a forum into one my menu primary links.
I just copy and pasted it into the end of the template.php, changed NAMEOFYOUTHEME to my Zen theme and saved it. This is the only change/edit I've made to the template.php file.
Upon refreshing my Drupal site this error was thrown up
"Parse error: parse error in C:\xampp\htdocs\drupal515\themes\zen\zen_stomper\template.php on line 309"
Advice?
If you want a workaround
If you want a workaround that does not require modifying the core, try this. In your page.tpl.php file, replace:
with:
Still, I agree that this should be a setting somewhere.
--
Read more at iRolo.net
After thinking about it over
After thinking about it over the weekend, I realized that the code above will cause theme('blocks', 'left') to be called twice on normal pages. It would be better to do something like this:
--
Read more at iRolo.net
Is a Drupal 6 solution
Is a Drupal 6 solution available as well?
Same issue..
yes, there's a solution
yes, there's a solution here: http://drupal.org/node/129762#comment-1013470
- Vivian