In order to make my blocks easier to manage I recently created some new page.ptl.php files so I could create a bunch of front pages for different sections of the site. What I have done removed the content region and changed the name of the right side bar region to allow me to add views blocks for different things.
http://www.binaryreleases.com/music
that one is a good example
What happens however is that the body class does not recognise the new block regions (displays one-sidebar sidebar-left) and the layout.css then expands the content region to be the size it would be if it was only side bar left and content. The result of which is that the renamed side bar right regions sit on top of the content.
the only work around I have is to put a block into sidebar right and have it show on all pages. The problem with this however is I dont' want it to be visible on all pages and it also causes problems with some of the admin menus which were designed to not have a right content region when being edited.
So my question is how do I get the body class to pick up the new side bar right regions.
Comments
Comment #1
hedley commentedTo change the zen body class's look at the zen_preprocess_page function in zen's internal template.php (on line 122 in zen 6.x-1.1) and write your own theme function based on this to add to the $body_class's variable, and put in template.php in your sub-theme folder, something like this should work to add a class if a region has content within it:
function YOURTHEME_preprocess_page(&$vars, $hook) {
// Add conditional stylesheets.
// Classes for body element. Allows advanced theming based on context
// (home page, node of certain type, etc.)
$classes = explode(' ', $vars['body_classes']);
if ($vars['YOUR-REGION']) {
$classes[] = 'YOU-REGION-CSS-NAME';
}
$vars['body_classes_array'] = $classes;
$vars['body_classes'] = implode(' ', $classes); // Concatenate with spaces.
}
I would also recommend looking at the Context module: http://drupal.org/project/context, it will allow you to add block's in a more advanced way than Drupal's standard block editor.
Comment #2
binaryreleases commentedThanks heaps for the heads up about the context module. Much simpler way to do things, now pretty much doing whole page structures using it instead of through blocks. Makes things a heap easier.
Comment #3
neclimdul