Drupal: visibility of side bars and custom regions on 404


Drupal hides the left and right side bar on a 404 not found error. In itself this may be a good thing because when your site gets hit with a lot of 404's (not necessarily by humans) it can become a performance issue.

Drupal does this in includes/common.inc with drupal_not_found():

  // To conserve CPU and bandwidth, omit the blocks.
  print theme('page', $return, FALSE);

Any custom region that you create will not be hidden, just the left and right side bars. Depending on what you're after this may look a bit odd.

This problem can be solved with the block visibility for the individual blocks that you added to your custom region. If you set up your custom 403 and 404 pages in a logical way (admin/settings/error-reporting) — e.g. error/403 and error/404 — you can simply change the visibility settings for the blocks (admin/build/block).

Block visibility

If you want full control over what blocks are displayed regardless of the region simply rename your left and right side bars to something else using the theme's .info file:

; Theme regions
regions[left]     = Left sidebar
regions[right]    = Right sidebar
regions[content]  = Content
regions[header]   = Header
regions[footer]   = Footer
regions[bottom]   = Bottom block bar

If you add a region, you need to define all regions, including the existing ones.

Rename the default left and right regions to something else and you can control the visibility of all the blocks in that region with the visibility setting.


Hi, I could not find a better place to ask this. This site uses Marinelli theme be Leoni. I asked this question to Leoni also on his site, but he did not reply. How do I get that horizontal menu below the main banner??

Can you share the template & css you used to achieve that??

You mean the menu with the orange background? That is the secondary menu. From my page.tpl.php:

<?php if ($secondary_links) { ?>
  <div id="submenu">
    <?php print theme('links', $secondary_links, array('class' => 'links secondary-links')); ?>
<?php } ?>

The secondary links you can configure with: admin/build/menu-customize/secondary-links. Also verify that you have secondary menus enabled with: admin/build/menu/settings ("Source for the secondary links").

Edit: I am no longer using the default theme, and I am no longer using the orange bar for the secondary menus.

Hi I currently building a website using the marinelli theme can you please tell me how to resize the left sidebar. I have made changes to the layout.css in the ".short and .long and the lsidebar" css but they do not seem to make a difference ....help me please.

Thank you very much for your assistance.

It helps if you take a look at the page template page.tpl.php, in addition to the layout.css style sheet.

Also, if you go to the demo site at http://www.signalkuppe.com/marinelli/ you can play with the values (if you are using FireFox, I highly recommend the Firebug extension).

In the page template file, you'll see that the main content area and both side bars (if you are using those) are contained in the <div class="wrapper"></div>. The main content is contained in <div id="primary"></div>. But you'll see that that DIV has a class, depending on whether the side bars are shown. The class names are generated in template.php in the marinelli_width($left, $right) function and can be "short" or "long".

The side bars are contained in <div class="lsidebar"></div> and <div class="rsidebar"></div>.

So by subtracting a number of pixels from the "short" and "long" classes, and by adding a number of pixels to the left and right side bars classes, you can re-size the areas as you see fit. I am using the theme, but modified it to suit my needs. My side bar is 235px wide, instead of the standard 180px from the default theme.

For example, I am looking at the demo site, and I subtracted 20px from <div id="primary" class="short"> and added 10px to the <div class="lsidebar"> and <div class="rsidebar">.

Also, it can't hurt to clear the cache when you're done (depending on the performance settings under admin/settings/performance). And don't forget to force a reload of the page to see the result.

By the way, I can recommend making a sub-theme, as opposed to modifying all the files from the original theme. This way, you can easily revert back and it is easier to upgrade.


I've made the sub-theme like you recommended and I also edited the .short to 375px and .long to 625px while editing the lsidebar to 280px and rsidebar to 80px but this still is giving me what I want. I have three blocks in the left sidebar where the content within these blocks aren't fitting correctly. Not sure if there is a step I am missing?

OK, I had to set up a quick test site locally with Marinelli 6.x 2.96, because my site is still based on an older version. (I have manually updated some stuff and kept modifying and deviating from the original.) So I assumed Drupal 6, and Marinelli 2.96.

First of all, you have modified more than just the width of the left and right side bars (as I understood your objective to be from your first comment).

I created a simple test sub theme based on giordani (side bars left and right of primary content, although it doesn't really matter) with the following files:


; $Id: marinelli.info,v 1.3 2008/09/18 21:28:29 lioz Exp $
name = Marinelli Test
description = A fresh 3-column layout for Drupal. Still usable over 4000m!
version = VERSION
core = 6.x
engine = phptemplate
stylesheets[all][] = marinelli_test.css
base theme = giordani

; Information added by drupal.org packaging script on 2008-04-04
version = "6.x-1.7"
core = "6.x"
project = "marinelli"
datestamp = "1207295410"


.lsidebar {
  width: 280px;

.rsidebar {
  width: 80px;

This gives this me what I understand you want: a left side bar of 280px wide, a right side bar of only 80px wide. The #primary.short width remains unchanged at 550px.

You wrote you made the #primary.short only 375px wide. This is significantly shorter than the header, primary and secondary menus. When you only modify the width of the side bars, the primary area width does not need to change.

Should you desire a shorter or wider primary area, then you also need to modify the #page width (default is 970px wide).


#wrapper margin-left 15px
margin-right 15px
#primary.short width 550px
.lsidebar width 180px
margin-right 15px
.rsidebar width 180px
margin-left 15px
total 970px

As you can see, the sum of these is exactly the same width as the width of the #page.

This may not be an issue with the Marinelli theme or your sub-theme, but rather an issue with the blocks that you place in these side bars. I would take a closer look at the styles for these blocks.

Start by temporarily removing blocks from the side bars that are not native Drupal blocks. You should place a few standard Drupal blocks in the side bars to ensure that your sub-theme is giving you the result you want.

Then by adding one block at a time back, you can see which of those blocks is the culprit. The content width may be set too wide, for example, and bleeding over into the primary content. Or they may push the primary content over. Remember, everything has to fit in the 970px of the standard theme.

You should then create styles in the CSS file for your sub-theme to override the styles for these blocks to make them work.