Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I'm using Omega, and have 6 regions in a particular zone. The first and second region span the width of the zone with 12 columns, and the other 4 are 1/4 in-line blocks. I want to set the background for the 4 in-line blocks to a particular color. How can I wrap those 4 regions inside a div so I can set the background color?

share|improve this question

1 Answer

up vote 1 down vote accepted

How can I wrap those 4 regions inside a div so I can set the background color?

You can use .tpl files for that.

<?php if ($region_first || $region_second): ?>
    <div class="your_color_class">

        <?php if ($region_first): ?>
            <div id="region_first">
                <?php print $region_first; ?>
            </div>
        <?php endif; ?>

        <?php if ($region_second): ?>
            <div id="region_second">
                <?php print $region_second; ?>
            </div>
        <?php endif; ?> 

    </div>
<?php endif; ?> 
share|improve this answer
No way to do this in pre-process? – vintorg Jun 5 at 23:48
You can use preprocess function to add a css class to regions, it's ok, but if you need to add some html you ought to use .tpl files - that's what they are for. There is no way to wrap several or even one region in div with preprocess function. At most you can wrap the content, but not the entire region. – Jack-PL Jun 6 at 12:19
I see. To stay in proper flow, I should probably create a new zone for those regions. – vintorg Jun 6 at 21:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.