Download & Extend

Suffering from div-itis?

Project:Omega
Version:7.x-3.0
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

This isn't so much an issue but more a discussion. I've just started using Omega and while I'm still getting my head around how it all works, so far it's looking good and very flexible. I do have a concern than perhaps the code that is being generate is a little div-heavy. For example, on the Omega homepage (http://omega.developmentgeeks.com/), the block showing the main menu consists of the following:

<div id="zone-menu-wrapper" class="zone-wrapper zone-static-wrapper zone-menu-wrapper clearfix"> 
  <div id="zone-menu" class="container-12 zone zone-menu zone-static clearfix">
    <div id="region-menu" class="grid-12 region region-menu">
      <div class="region-inner region-menu-inner">
        <div id="block-block-41" class="block block-block omega-menu block-41 block-block-41 odd block-without-title">
          <div class="block-inner clearfix">
            <div class="content clearfix">
              <div class="container-12">
                <div class="grid-12">
                  <ul class="main-menu">
                    <li><a href="http://omega.developmentgeeks.com/">Omega Overview</a></li>
                    <li class="omega-docs"><a href="http://drupal.org/node/819164">Omega Handbook</a></li>
                  </ul>

While I realise to make the theme more flexible, it's going to need some number of containers, it's just that when I see this, it makes me twitch a little bit!

Any thoughts?

Comments

#1

Those divs as you pointed out increase the flexibility and I find useful. They also have the side effect of making the html self documenting.

#2

You can cut down on the amount of divs that omega puts out by half through unchecking using the full width wrapper on each zone and region, which is on by default.

Most of the rest of them are normal Drupal output. Often Drupal has for each special section type (node, region, block, etc) a corresponding tpl.php file that looks like

<div class=section-type <?php print $classes; ?>">
<?php print $content; ?>
</div>

So you can cut down on the amount of divs by creating new tpl.php files that just print $content. If you have anything that relies on adding classes into the different section types then this will of course break, so it's up to you to experiment if trying to cut down on the divs will break your site.

#3

Status:active» needs review

#4

yep, coming here as i'm looking for a way to programmatically disable wrapper-divs for zones, sections and regions

#5

templates could so some of i

#6

yes my solution so far is creating template overrides for all those

#7

Status:needs review» active

Templates overrides is probably the best solution for now. We can think about adding a slim version of all these templates by default so users can select which one they want via the UI.

#8

#7 sounds like a plan

#9

Isn't there already a way to remove div wrappers?

#10

+1 * >9000 for #7. That would be quite nice

nobody click here