title: How to assign class based on if Drupal region is used?
body: <p>In a Drupal 7 theme, how do I assign a class name to a region if it is used or not? I need three conditions for the region in question for my Drupal theme. There are three content regions: sidebar_first, content and sidebar_second. The code for it is below:</p>
  
  <pre><code>                    &lt;?php if ($page['sidebar_first']): ?&gt;
                      &lt;div id="sidebar-first" class="column sidebar"&gt;
                          &lt;div class="section"&gt;
                              &lt;?php print render($page['sidebar_first']); ?&gt;
  
                              &lt;div class="clear"&gt;&lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class="clear"&gt;&lt;/div&gt;
                      &lt;/div&gt;
                      &lt;?php endif; ?&gt;
  
                      &lt;div id="content" class="column"&gt;
                          &lt;div class="section"&gt;
                              &lt;?php if ($page['highlighted']): ?&gt;
                              &lt;div id="highlighted"&gt;
                                  &lt;?php print render($page['highlighted']); ?&gt;
                              &lt;/div&gt;
                              &lt;?php endif; ?&gt;
  
                              &lt;a id="main-content"&gt;&lt;/a&gt;
  
                              &lt;?php print render($title_prefix); ?&gt;
  
                              &lt;?php if ($title): ?&gt;
                              &lt;h2 class="title" id="page-title"&gt;
                                  &lt;?php print $title; ?&gt;
                              &lt;/h2&gt;
  
                              &lt;div class="title_sep"&gt;
                                  &lt;div class="title_sep_left"&gt;&lt;/div&gt;
                                  &lt;div class="title_sep_right"&gt;&lt;/div&gt;
  
                                  &lt;div class="clear"&gt;&lt;/div&gt;
                              &lt;/div&gt;
                              &lt;?php endif; ?&gt;
  
                              &lt;?php print render($title_suffix); ?&gt;
  
                              &lt;?php if ($tabs): ?&gt;
                              &lt;div class="tabs"&gt;
                                  &lt;?php print render($tabs); ?&gt;
                              &lt;/div&gt;
                              &lt;?php endif; ?&gt;
  
                              &lt;?php print render($page['help']); ?&gt;
  
                              &lt;?php if ($action_links): ?&gt;
                              &lt;ul class="action-links"&gt;
                                  &lt;?php print render($action_links); ?&gt;
                              &lt;/ul&gt;
                              &lt;?php endif; ?&gt;
  
                              &lt;?php print render($page['content']); ?&gt;
  
                              &lt;?php print $feed_icons; ?&gt;
  
                              &lt;div class="clear"&gt;&lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class="clear"&gt;&lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;?php if ($page['sidebar_second']): ?&gt;
                      &lt;div id="sidebar-second" class="column sidebar"&gt;
                          &lt;div class="section"&gt;
                              &lt;?php print render($page['sidebar_second']); ?&gt;
  
                              &lt;div class="clear"&gt;&lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class="clear"&gt;&lt;/div&gt;
                      &lt;/div&gt;
                      &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>If sidebar_first is on the page, then assign the class name 'twocol_left' to <code>&lt;div id="content" class="column"&gt;</code>. If sidebar_second is present, then assign the class name 'twocol_right' to <code>&lt;div id="content" class="column"&gt;</code>. Lastly, if sidebar_first and sidebar_second are present, then assign 'threecol' to <code>&lt;div id="content" class="column"&gt;</code>.</p>
  
  <p>Could someone please help me with this? Perhaps this would be a simple as adding an if/else for <code>&lt;div id="content" class="column"&gt;</code> inside the class="column"?</p>