[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

Assigned:Unassigned» himerus
Status:Active» Needs work

Sorry 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.

; CONTENT REGIONS

; REQUIRED CORE REGIONS

regions[page_top] = Page Top
regions[page_bottom] = Page Bottom
regions[content] = Content

; END REQUIRED CORE REGIONS
regions[user_bar_first] = User Bar First
regions[user_bar_second] = User Bar Second

regions[sidebar_first] = Sidebar First
regions[sidebar_second] = Sidebar Second

regions[header_first] = Header First
regions[header_second] = Header Second

regions[preface_first] = Preface First
regions[preface_second] = Preface Second
regions[preface_third] = Preface Third
regions[preface_fourth] = Preface Fourth

regions[postscript_first] = Postscript First
regions[postscript_second] = Postscript Second
regions[postscript_third] = Postscript Third
regions[postscript_fourth] = Postscript Fourth

regions[footer_first] = Footer First
regions[footer_second] = Footer Second

; END CONTENT REGIONS

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.

; CONTENT ZONES

zones[user][] = user_bar_first
zones[user][] = user_bar_second

;-----/ The branding zone is required and contains "special" content items
zones[branding][] = branding
zones[branding][] = menu

zones[header][] = header_first
zones[header][] = header_second

zones[preface][] = preface_first
zones[preface][] = preface_second
zones[preface][] = preface_third
zones[preface][] = preface_fourth

;-----/ The location zone is required and contains "special" content items
zones[location][] = breadcrumb

;-----/ The content zone is required and contains required content items
;-----/ The content region should ALWAYS be first for source ordering.
zones[content][] = content
zones[content][] = sidebar_first
zones[content][] = sidebar_second

zones[postscript][] = postscript_first
zones[postscript][] = postscript_second
zones[postscript][] = postscript_third
zones[postscript][] = postscript_fourth

zones[footer][] = footer_first
zones[footer][] = footer_second

; END CONTENT ZONES

Status:Needs work» Reviewed & tested by the community

Sorry, the above code would apply to the .info file for your subtheme.

Bloody 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.

I 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

zones[content][] = breadcrumb

without any success.

Thank you,
apanag

Thank you for the documentation.
DocuAnt

Title:New Regions?New Region?

Nice 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

In your .info file add something like:

regions[top_advertisement] = Top advertisement region

Then, lower down in the .info file in the zone definitions change:

;-----/ The branding zone is required and contains "special" content items
zones[branding][] = branding
zones[branding][] = menu

to (assuming that you want an ad between the logo and menu):

;-----/ The branding zone is required and contains "special" content items
zones[branding][] = branding
zones[branding][] = top_advertisement
zones[branding][] = 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...

SWEET! 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.

Status:Reviewed & tested by the community» Fixed

Marking fixed. I WILL work on more/better documentation soon!!!

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Version:7.x-2.x-dev» 7.x-3.0-rc5
Assigned:himerus» Unassigned
Status:Closed (fixed)» Needs review

Is there documentation available for the 7.x-3.0 version?

The explanation in #1 doesn't seem to match the .info-file anymore.

Status:Needs review» Closed (fixed)

Ok, 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).

; REQUIRED CORE REGIONS

regions[page_top] = Page Top
regions[page_bottom] = Page Bottom
regions[content] = Content

; ADDITIONAL REGIONS

regions[user_first] = User Bar First
regions[user_second] = User Bar Second

regions[branding] = Branding
regions[menu] = Menu

regions[sidebar_first] = Sidebar First
regions[sidebar_second] = Sidebar Second

regions[header_first] = Header First
regions[header_second] = Header Second

regions[preface_first] = Preface First
regions[preface_second] = Preface Second
regions[preface_third] = Preface Third

regions[middle] = Middle

regions[postscript_first] = Postscript First
regions[postscript_second] = Postscript Second
regions[postscript_third] = Postscript Third
regions[postscript_fourth] = Postscript Fourth

regions[footer_first] = Footer First
regions[footer_second] = Footer Second

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.

; THEME SETTINGS (DEFAULTS)

(...)

settings[alpha_region_content_equal_height_container] = ''
settings[alpha_region_content_equal_height_element] = ''
settings[alpha_region_content_force] = ''
settings[alpha_region_content_zone] = 'content'
settings[alpha_region_content_prefix] = ''
settings[alpha_region_content_columns] = '6'
settings[alpha_region_content_suffix] = ''
settings[alpha_region_content_weight] = '2'
settings[alpha_region_content_css] = ''
settings[alpha_region_middle_equal_height_container] = ''
settings[alpha_region_middle_equal_height_element] = ''
settings[alpha_region_middle_force] = ''
settings[alpha_region_middle_zone] = 'Middle region'
settings[alpha_region_middle_prefix] = ''
settings[alpha_region_middle_columns] = '8'
settings[alpha_region_middle_suffix] = ''
settings[alpha_region_middle_weight] = '4'
settings[alpha_region_middle_css] = ''

(...)

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)

; ZONES

zones[user] = User
zones[branding] = Branding
zones[menu] = Menu
zones[header] = Header
zones[advertising] = Advertising space
zones[preface] = Preface
zones[content] = Content
zones[postscript] = Postscript
zones[footer] = Footer

Next add its default features (bold). These are configurable via the UI afterward.

; THEME SETTINGS (DEFAULTS)

settings[alpha_zone_header_equal_height_container] = ''
settings[alpha_zone_header_wrapper] = '1'
settings[alpha_zone_header_force] = ''
settings[alpha_zone_header_section] = 'header'
settings[alpha_zone_header_weight] = '4'
settings[alpha_zone_header_columns] = '12'
settings[alpha_zone_header_primary] = ''
settings[alpha_zone_header_css] = ''
settings[alpha_zone_header_wrapper_css] = ''
settings[alpha_zone_advertising_equal_height_container] = ''
settings[alpha_zone_advertising_wrapper] = '1'
settings[alpha_zone_advertising_force] = ''
settings[alpha_zone_advertising_section] = 'header'
settings[alpha_zone_advertising_weight] = '4'
settings[alpha_zone_advertising_columns] = '24'
settings[alpha_zone_advertising_primary] = ''
settings[alpha_zone_advertising_css] = ''
settings[alpha_zone_advertising_wrapper_css] = ''

Now this zone should be available in your Omega settings UI.

What 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.

@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.

Thanks 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.

regions[standard_omega_region] = 'Standard Omega Region'
regions[standard_omega_region][sub1] = 'First Sub Region'
regions[standard_omega_region][sub1][sub2] = 'Second Sub region'

Which would look something like this when viewing the page in firebug
<div class="standard_omega_region">
     //your block information goes here
    <div class="sub1">
        //your multilayer block information goes here
        <div class="sub2">
             //your multilayer block information goes here
    </div>
</div>
//your block information goes here
</div>

Doing it the multi-level custom CSS class way.

<div class="standard_omega_region custom_css_class">
    <div class="custom_css_class-second_level_custom_class">
       <div class="second_level_custom_class-third_level_custom_class">
    </div>
</div>
</div>

I figured out how to do it by creating a custom region.tpl.php which basically looks like this.

<div<?php print $attributes; ?>>
<?php if (strpos($attributes,'nested-div') !== false): ?> <div class="first-nested-div"><div class="second-nested-div"><?php endif; ?>
  <div<?php print $content_attributes; ?>>
  <?php print $content; ?>
  </div>
<?php if (strpos($attributes,'nested-div') !== false): ?> </div></div><?php endif; ?>
</div>

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.