Closed (fixed)
Project:
Fusion
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Jun 2010 at 14:08 UTC
Updated:
15 Apr 2014 at 17:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jeremycaldwell commentedComment #2
gmclelland commentedI noticed in includes/theme.inc the .no-sidebars class is defined if the $variables['layout'] == 'none'.
Maybe in template.php we can just set $variables['layout'] == 'none' if $vars['sidebar_first'] and $vars['sidebar_last'] = empty?
It also looks like .no-sidebars body class is always printed in Fusion themes.
What do you think?
Comment #3
stephthegeek commentedMy understanding is that we can't fix this. These are the body classes used by core, except they're not accurate because we use RTL-friendly sidebar names rather than right/left. Fusion adds its own .layout-main, .layout-first-main-last, etc which are accurate.
Comment #4
gmclelland commentedWell, could fusion supply a fusion-no-sidebars body class?
Comment #5
stephthegeek commentedIt does. That's .layout-main :)
Comment #6
gmclelland commentedGreat. Easy enough
Comment #7
muhleder commentedSorry for re-opening this, but it seems a bit of an unnecessary wtf in such a great theme.
Couldn't we just put something like
around the top of fusion_core_preprocess_page()?
Thanks,
Mark
Comment #8
digitalfrontiersmediaI second this. no-sidebars has been pretty standard for a while. Why not try to translate this so it is more similar to what people have grown accustomed to coming out of Drupal Core? It would indeed make adoption a little less confusing. As it stands now, it's definitely odd for it to say no-sidebars when there are. And might invoke unintended CSS, which is probably misinterpreted by some as "bugs" in Fusion...
Comment #9
galactus commentedFusion is a great theme, this issue is small, but can be so helpful for themeing.
Comment #10
pixelwhip commentedI created a patch that preserves the core .no-sidebars, .one-sidebar, two-sidebars body classes.
This is my first patch, so any feedback on how it can be improved would be much appreciated.
Comment #11
jrabeemer commented#10 works for me.
It's simple enough.
Comment #12
aosiname commented#10 worked for me also for drupal 6.x site
i used zen once and if i had for example a url alias to alias all photo pages like so:
photos/photo-1
photos/photo-2
photos/photo-3
it would add a class "section-photos" to the body like on:
http://www.livelinknewmedia.com/digital-marketing/Customer%20Acquisition
I am sure i have seen fusion do this also using a class of "page-photos" on the body but it doesnt seem to happen anymore.
Any ideas?
check out http://luc.osinova.co.uk/image-galleries/christmas-2009
it adds "page-image" to the body - although it should technically be page-image-galleries
but it doesnt work on my other fusion sites
Comment #13
aosiname commentedfollowing #10s example, i managed to get it working.
heres the code i added to fusions template.php
/*add a body class for arg(0)*/
$curr_path = drupal_get_path_alias($_GET['q']);
$curr_path_array = explode("/", $curr_path);
$curr_path_0 = $curr_path_array[0];
$body_classes[] = 'section-' . $curr_path_0;//strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', drupal_get_path_alias($_GET['q']))); // add a class based on arg 0
/*END add a body class for arg(0)*/
Comment #14
toddota commented#10 worked for me. Awesome! Thanks pixelwhip.
Comment #15
stephthegeek commentedComment #16
aquariumtap commentedThe attached patch is a slight variation on #10.
Intended behavior:
.no-sidebarsclass will only show when no sidebars are present, fixing this issue.one-sidebarwhen only one sidebar is in use.two-sidebarswhen two sidebars are in useComment #17
aquariumtap commentedPlease disregard above patch, I forgot to roll out the most recent version :) See this one instead.
Thank you pixelwhip for fixing this!
Comment #18
extensive commentedUSE FOLLOWING CODE IN template.php.......and give ur sidebar classes
function phptemplate_body_class($sidebar_first, $sidebar_last) {
if ($sidebar_first != '' && $sidebar_last!= '') {
$class = 'sidebars';
}
else {
if ($sidebar_first != '') {
$class = 'sidebar_first';
}
if ($right != '') {
$class = 'sidebar_last';
}
}
if (isset($class)) {
print ' class="'. $class .'"';
}
}
---------
AND
------
print phptemplate_body_class($sidebar_first, $right);
GIVE THAT CODE FOR BODY TAG IN page.tpl.php
Comment #19
aquariumtap commentedComment #21
hansrossel commentedThe Zen theme has the same issue, this is how it is solved there:
Comment #22
toddwoof commentedUntil another fix comes along, we added this to the subtheme's template.php to remove the "no-sidebars" class if there is content in either of the sidebars:
function YOURTHEMENAME_preprocess_page(&$variables) {
if($variables['sidebar_first'] != '' || $variables['sidebar_last'] != ''){
$variables['body_classes'] = str_replace('no-sidebars', '', $variables['body_classes']);
}
}
Comment #23
nabajit commentedChanging the following in theme.info file resolved this issue for me_
regions[sidebar_first] = Left Sidebar
regions[sidebar_second] = Right Sidebar
I guess sidebar_first and sidebar_second is the default name of these regions to body classes work correctly.
Thanks.
Comment #24
limbovski commentedFixed in Drupal 7 by changing:
regions[sidebar] = Sidebarto
regions[sidebar_first] = Sidebarin my themes .info file.
I assume Drupal bases it's decisions on the region names sidebar_first, sidebar_second...
Comment #25
Poieo commentedThis has been fixed in Fusion core for some time now.