HI,

I would like to understand better the reason why when i disable the left sidebar my content naturally shifts over and fluidly fills the empty space.

I am in the midst of creating a theme, and for some reason I don't understand the CSS in your layout. I love your theme and would like to use it to create some themes for Penn State University. However I will be adding more regions to the theme and can't seem to understand how the theme knows when there is one sidebar present or two and why the content area reacts to it. Please help... I have inserted the code below because i think this is why it does it?

/* Sidebars width
 * --------------
 * Changing the width of the sidebars is dead easy, just change the
 * values below corresponding to the sidebar you want to modify.
 * Make sure you keep negative values as negative values.
 * For example, if I want to increase the width of the left sidebar
 * to 300px, I would have to change each '190' to '300'. */
/* line 56, ../sass/layout.sass */
.two-sidebars .center,
.sidebar-left .center {
  margin-left: 190px;
}

/* line 60, ../sass/layout.sass */
#sidebar-first {
  width: 190px;
  margin-right: -190px;
}

/* line 66, ../sass/layout.sass */
.two-sidebars .center,
.sidebar-right .center {
  margin-right: 200px;
}

/* line 70, ../sass/layout.sass */
#sidebar-second {
  width: 200px;
}

Comments

bradallenfisher’s picture

I was actually researching the wrong subjects... after some more heavy researching, I found that the body classes are doing the heavy lifting and the css is reacting to them. so here is a great article on how to add a body class based on whether you have a custom region in place.
http://www.crimsonlizard.com/blog/adding-custom-body-classes-standard-dr...

if that link is down i copied the page
Submitted by Rob Rhead on Tue, 10/08/2010 - 11:03am

Here's a great trick if you need to add custom classes to the body tag output of your Drupal theme. This goes above the standard body tag output using a line like this in your page.tpl.php

<body class="<?php print $body_classes; ?>">

Which only creates the usual body classes like:

<body class="front logged-in page-node one-sidebar sidebar-right">

These are great for adding custom CSS formatting to a page. But I have sometimes found the need to add my own classes above the standard Drupal output, specifically if I need a body class attribute when custom regions are displayed. Here's how:

Open or create the template.php in your themes folder and add the following code.

function YOUR-THEME_preprocess_page(&$vars, $hook) {
// Pull in all the body class variables currently set
// into the variable in this function so it can be edited
  $body_classes = array($vars['body_classes']);

// Check to see if the region is being used and if so
// then adds the region CSS class to the variable.
  if ($vars['custom_region']) {
    $body_classes[] = 'custom-region';
  }

// Add the new body classes to the existing variable and
// push back into the default variable used in theme creation.
  $vars['body_classes'] = implode(' ', $body_classes);
  
}

Thats it. You will need to empty the theme cache before the changes take place. But now you should see the following in your source code.

<body class="front logged-in page-node one-sidebar sidebar-right custom-region">

If the function 'preprocess_page' is already being called in your template.php you will need to combine these code blocks together because you can't call the same function twice.

How cool is that?!

SteveK’s picture

Status: Active » Closed (won't fix)

baf139 hit it right on the button. Please refer to his post if you have any questions, otherwise.. closing :)

quercus020’s picture