First, let me just say congrats for the new fusion site and business-- i'm getting really really excited about the future of drupal theming. I've poked around fusion from time to time, but I finally decided to go all in and commit to using it as a base theme and I have to complement you on the cleanliness and tightness of the code-- its brilliant.
ok, now to my question. I'm not a professional caliber themer by any means but i'm usually pretty comfortable hacking away to get what I need and add and change regions. However, I don't want to hack away at fusion, lol. I need to add 2 regions, sidebar-top and sidebar-bottom, that appear above and below the sidebar-first and last regions while both are on the right and span the width of both. Something like:
---------------------
sidebar-top
---------------------
last | first
---------------------
sidebar-bottom
---------------------
However, I opened up page.tpl.php and I've no clue how to proceed correctly, lol. Any clues or suggestions on how to do this the 'fusion' way would be greatly appreciated.
And thanks again for a great starter theme!
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | fusion_last_sidebar.JPG | 78.49 KB | vacilando |
| #1 | am_blocklayout.png | 132.74 KB | jeremycaldwell |
Comments
Comment #1
jeremycaldwell commentedThanks for the compliments WorldFallz. Is the attached image the sort of layout you are wanting to achieve with your sidebar? If so, it can be done through the theme's Skinr settings applied to the blocks. Let me know if that's the layout and then I'll show you how I did it.
Comment #2
jeremycaldwell commentedSorry I think I misread your question there :)
What I did in the screenshot was with blocks in the "Sidebar first" region only. If you want to actually add new regions to the theme you can do that in the "page.tpl.php" and the theme's ".info" file. Be sure to clear your cache on the Performance page and then the regions should show up for you.
Comment #3
WorldFallz commentedYep that's the type of layout I'm after-- I hadn't considered using skinr block settings and doing it with a single sidebar instead of two. Great idea-- I think I know how to do it. I'll give it a shot and post back.
Comment #4
WorldFallz commentedok, nm-- i don't know how to get that layout, lol. Any tips would be great.
Comment #5
jeremycaldwell commentedWhat I did was add five blocks to the sidebar region and then the second and third ones I set a fixed width on them through Skinr. So you configure those blocks and choose a width of say 3 units. Once you apply that Skinr style to the two blocks (second and third ones) then they will automatically float side-by-side if the sidebar is wide enough for that. If the two blocks are skinny now but not floating side-by-side, you need to increase the width of your sidebar.
To increase the width of the sidebar go to your theme's configuration page and under "Layout" change the width of the first sidebar to something wider to accommodate the width of the two blocks in the sidebar that need to be floated next to each other. Adjust the width of the sidebar column until you get the layout you want.
Hope that helps!
Comment #6
WorldFallz commentedOk, i'm not crazy-- that's what I thought and what I tried. Turns out it doesn't work with the fluid grid, only the 960 fixed grid, so I'm back to trying to figure out how to add regions above and below the sidebars. Thanks for the advice though!
Comment #7
jeremycaldwell commentedComment #8
WorldFallz commentedOK I gave up trying to add regions-- the code is far beyond me, lol. So I went back to try and get the method you suggested back in #5 to work with the fluid grid.
I'm thinking it might be a bug in the fluid grid or skinr code somewhere-- it's completely ignoring the .grid16-3 width class (it's crossed out when I inspect with firebug). I'm nowhere near enough of a css jockey to figure out how to fix this properly in order to submit back as a patch, but the following fixed it for me for now:
Comment #9
stephthegeek commentedHey WorldFallz, when you say it "doesn't work with the fluid grid", can you describe what you mean in a bit more detail? The same layout in the sidebar (like what eternalistic posted) should work in fluid width -- if it doesn't, this sounds like a bug in Fusion.
Comment #10
jeremycaldwell commentedstephthegeek, I tried locally and it doesn't work with Fluid yet it works with Fixed. I'll file an issue for it.
Comment #11
WorldFallz commentedYou bet!
At "admin/build/themes/settings/fusion_starter" I have the "Select a grid layout for your theme:" setting in the Fusion Theme Settings -> General Settings -> Layout fieldset set to "16 column fixed grid [960px] - Theme Default". It works perfectly-- exactly as your screencap above shows.
Then, when I select the "16 column fluid grid" option (the only other option for that setting), all the blocks in the sidebar-first region somehow get "width: 100%" and fill up the entire sidebar first section of the page-- including the ones i specifically set to be 3 units wide in their skinr settings.
When I inspect with firebug i see:
#page .sidebar-first .block, #page .sidebar-last .block { (grid16-fluid.css (line 48)) width:100%; } .grid16-3 { (grid16-fluid.css (line 9))width:18.75%;}Let me know if you need to know anything else.
Comment #12
jeremycaldwell commentedComment #13
stephthegeek commentedOhhh yeah, ok it's all coming back to me now. I remember going through this whole process and why this is the case.
This is sort of a "by design" thing because it was the only simple way to have the grid widths work universally across fixed & fluid. The bit you pasted from Firebug tells the story -- if your sidebar is 3 units wide, Fusion automatically sets the blocks in that region to match, but in fluid, that's 18.75%... and you don't want all your sidebar blocks to be 18.75% of the sidebar width :) Technically what you'd want is the 50% option (i.e. .grid16-8 in fluid), but we're overriding any options in there to address this issue anyway.
BUT, now that you bring it up, it's a bummer to have this limitation on the sidebars. It's not something we're going to be able to look at right away, but we'll come back to it.
In the meantime, a bit of code in your local.css will take care of this.
Something like:
Then set any blocks you want to be the half width to be the 50% option (8 grid units) wide. At least this is easier than creating new regions :)
This isn't a universal fix because it doesn't scale well in terms of allowing arbitrary widths to be set as needed... so we'll need to come up with an algorithm in Fusion itself to handle this.
Thanks!
Comment #14
WorldFallz commentedYeah I wondered how you were able to get both grid and fluid options into one theme. Thanks for the detailed response though-- much appreciated.
I figured out the local.css 50% fix myself so I'm good for now-- and yes, it's WAY easier than adding a region, lol (holy smokes what a complicated setup on the backend). If you need any help when you do get around to addressing this just let me know in the thread.
Comment #15
stephthegeek commentedOk great :) Adding just a plain block region is the same as it would be in other themes, but the sidebars are definitely the most complex area and require more going on behind the scenes for the automatic grid calculations.
Comment #16
sociotech commentedWorldFallz,
After some research, I've found a way for Fusion to allow user-defined widths for sidebar blocks in fluid width.
The default will still be for blocks to be 100% of the sidebar width, but you will now be able to set a fluid width on blocks using Skinr so that you can, for instance, have two 50% width blocks next to each other in the sidebar.
Of course, if you switch back to fixed width then you'll need to readjust the width of those blocks you've set a width on because they'll now be using grid units (e.g., a 50% fluid width block would become an 8 grid unit block in a fixed 16 unit grid).
This feature will be in the next release of Fusion.
Comment #17
WorldFallz commentedawesome-- i'll be sure to test it out when it's available!
Comment #18
stephthegeek commentedIn dev release
Comment #20
vacilando commentedHi,
I am using a fluid layout but I need to make sure that the last column blocks have a fixed width.
I've tried various versions of width settings (instead of the default 100%) such as
BUT this increases the width of the block/column but it stretches the block out of the screen's margins. Instead, what I need is that the fixed size of the block/column squeezes the page's content which is on the left appropriately so that the fixed width block shows.
This thread is very close to this question so I ask this here, with a hope that you guys can kindly advise a simple solution I am sure exists.
Comment #21
aquariumtap commentedHi Vacilando: to make sure I understand you correctly, you have two sidebars: first and second. You'd like the first sidebar and the $content area to be fluid, but the sidebar_second should be fixed. Is that right?
Comment #22
vacilando commentedHi aquariumtap. That's correct, first and last sidebar and the content in between them, fluid, aiming to cover 100% width of the screen.
The first sidebar on the left is fluid (and now empty) and that's fine, but the last (on the right) must probably be fixed because when something wider (e.g. an ad, or an image) is placed in the last sidebar, in small browser windows or on small resolution screens the wider element is only partially shown and the rest is disappearing beyond right browser edge.
You can see the behaviour in the attached screenshot (and at the moment also live here).
I tried to make the last column wider with the CSS above and it works but again it just disappears beyond the right edge.
So I am looking for a solution where the middle content part squeezes when on small screen but the side bar content shows in full. I thought using fixed width on last bar could be a solution but maybe there is even better solution?
Thanks for looking into this!