Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
[Newbie Question/Request 3] Last but not least a question: Is there an easy way to add new regions (like Preface Fourth) to the theme? Thanks in advance for your great work and answers. :-)
Comments
Comment #1
himerus CreditAttribution: himerus commentedSorry for the lack of docs so far on the 2.x version of the Drupal 7 version. I've been working so hard on getting the code working right, and trying to wait on screencasting any new features/etc. until they were really locked in, and working properly.
Currently, you may add a new region the same way you do in any other theme.
If you wanted to add a region into the preface section, take the following steps...
First, add your region as you would any normal region in any theme.
Now, you have an active new region, but with the concept of zones in the 2.x line of Omega, it's not quite ready to use as the regions are dynamically placed in page.tpl.php. Next we must place this new region in a zone.
Comment #2
himerus CreditAttribution: himerus commentedSorry, the above code would apply to the .info file for your subtheme.
Comment #3
RedTop CreditAttribution: RedTop commentedBloody fantastic! I was 'drafted' to create the new company site and have been doing research on which new starter theme to use (Zen-boy here). Starting off at D6 + 960 I have been going back and forth between 960 and various Omega versions.
As I really need to be able to add regions dynamically I have now settled on D7 + Omega 2.x... first impression is that both are wonderful pieces of tech.
I'm looking forward to a stable release of 2.x and some docs, although I appreciate the effort you're putting into the code now. Looks like you're making progress fast!
Thanks.
Comment #4
apanag CreditAttribution: apanag commentedI read my subtheme's .info, and i found the way to add or delete regions.
1) Is it possible to exclude the location zone? because you said that it is required.
2) I want to insert the breadcrumb, in the content zone. How can i do this? I tried
without any success.
Thank you,
apanag
Comment #5
DocuAnt CreditAttribution: DocuAnt commentedThank you for the documentation.
DocuAnt
Comment #6
fetsid CreditAttribution: fetsid commentedNice theme, very flexible everywhere but around the logo and site name.
Is there a way to add a region among this code? (region--branding.tpl.php) I have tried and it errors. I got it before and after this code but not within it. I want to add a banner ad here using a block. Or is there a better way.
The error I get is undefined variable in file region--branding.tpl.php line 49. I suspect that my new theme variable is not defined yet for some reason. I am not a strong php coder. Any help would be appreciated.
Scott
Comment #7
himerus CreditAttribution: himerus commentedIn your .info file add something like:
regions[top_advertisement] = Top advertisement region
Then, lower down in the .info file in the zone definitions change:
to (assuming that you want an ad between the logo and menu):
This will now give you in your theme settings the extra zone that you can configure the width of, and position it accordingly, then place your ad block as you see fit.
That "should" do it...
Comment #8
fetsid CreditAttribution: fetsid commentedSWEET! It was all about the position. I was making it harder than it needed to be.
Great work! I don't think I will need any other theme.
Thank You.
Comment #9
himerus CreditAttribution: himerus commentedMarking fixed. I WILL work on more/better documentation soon!!!
Comment #11
knalstaaf CreditAttribution: knalstaaf commentedIs there documentation available for the 7.x-3.0 version?
The explanation in #1 doesn't seem to match the .info-file anymore.
Comment #12
knalstaaf CreditAttribution: knalstaaf commentedOk, I've done a little investigation in the .info-file and think I know how this can be done for the 7.x-3.0 version.
Adding a region in Omega 7.x-3.0
First, add your region as you would any normal region in any theme (bold).
Now make the region available to a zone. I've done this by copy pasting the content region settings (around line 300 in the current info.file), renamed its reference, and gave proper amount of columns ("8") and weight ("4") to it, both are adjustable in the UI afterward ofcourse. See bold print.
Now this region should be available in your Omega settings UI.
Adding a zone in Omega 7.x-3.0
First create the zone's name (bold)
Next add its default features (bold). These are configurable via the UI afterward.
Now this zone should be available in your Omega settings UI.
Comment #13
mustardman CreditAttribution: mustardman commentedWhat about nested regions?
I am converting an html site that requires 4 regions so I am using the preface region for that. Inside each of those 4 regions I need to create sub-regions. They are nested as follows:
border-right>border-bottom>border-left>left-top-corner>right-top-corner>right-bottom-corner>left-bottom-corner
In the original html template this was done with nested DIV's and I don't see any other way to do it.
Comment #14
knalstaaf CreditAttribution: knalstaaf commented@Mustardman: I believe what you want to do is converting a html site to an Omega themed Drupal site that consists of 4 zones (instead of regions), of which each consists of regions (instead of sub-regions).
I'm not totally sure what you're up to, but that's what my gut feeling says. You can achieve this perfectly with the default zones (like "Preface") and regions. There's also the option to create extra zones and regions if you need to.
On the other hand your description of the nesting set-up gives me the impression that you would use the Omega structure only to achieve a certain CSS-behaviour. If so, then I must tell you that Omega is not meant for those purposes and will likely not serve your need there.
For further insight on the zones and regions principle, check this (recent) video. In this video you'll see that the developer only adds one line to the .info file to create an extra zone (
zones[advertising] = Advertising space
) or region (regions[middle] = Middle
). Not the nine extra lines I used in #12.Comment #15
mustardman CreditAttribution: mustardman commentedThanks for the reply and you are correct that this is being done for the CSS behaviour. Each layer is for inserting photoshop images that create a fancy polished looking box which is done in CSS as background images. That is done with nested DIV's as per the original professionally done html template. I concluded that Omega probably cannot do what I need even if I alter the design. The only way I think I can do it if I cannot do nested regions is to insert DIVs into the subtheme php code which is kind of an ugly way to do it. Maybe it is getting too messy to try do it the Omega way and it will be easier to create the theme from scratch.
I would like to suggest this as a future feature in Omega if it makes sense. Basically something that creates the equivalent of nested DIVs for CSS purposes. So just add regions within regions in the .info file. Or you could simply alter the current custom CSS classes in zones and regions feature to allow multi-levels. Then when you add a custom CSS class you can click on that class and add another CSS etc. etc. So the result when looking at the page with firebug is that I would see DIV classes within DIV classes. I think adding regions within regions is more flexible because you can do more stuff within each one that way rather than just CSS.
Which would look something like this when viewing the page in firebug
Doing it the multi-level custom CSS class way.
Comment #16
mustardman CreditAttribution: mustardman commentedI figured out how to do it by creating a custom region.tpl.php which basically looks like this.
Then I add a CSS class called nested-div to the region I want this to occur in. Seems to work and not too messy. Would be cleaner if Omega had the capability to do this in the .info file.