Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I got this d7 sidebar code from a theme and I am trying to make it work for d6..
Can someone help

Info file contains:
regions[sidebar_a] = 'Sidebar A'
regions[sidebar_b] = 'Sidebar B'

This is the code:

                  <?php 
                      if(isset($variables) && isset($variables['sidebars'])):

                        if(isset($variables['sidebars']['left'])):
                          foreach($variables['sidebars']['left'] as $value):
                            if (!empty($page['sidebar_'.$value])): ?>
                            <div id="sidebar-<?php echo $value; ?>" class="col-<?php echo $value; ?> sidebar left tb-height-balance tb-region tb-scope tb-sidebar tb-left">
                              <?php print render($page['sidebar_'.$value]); ?>
                            </div>
                        <?php endif; endforeach; endif; ?>

                      <?php 
                        if(isset($variables['sidebars']['right'])):
                          foreach($variables['sidebars']['right'] as $value):
                            if (!empty($page['sidebar_'.$value])): ?>
                            <div id="sidebar-<?php echo $value; ?>" class="col-<?php echo $value; ?> sidebar right tb-height-balance tb-region tb-scope tb-sidebar tb-right">
                              <?php print render($page['sidebar_'.$value]); ?>
                            </div>

                        <?php endif; endforeach; endif; ?>

                      <?php 
                        if(isset($variables['sidebars']['hidden'])):
                          foreach($variables['sidebars']['hidden'] as $value):
                            if (!empty($page['sidebar_'.$value])): ?>
                            <div id="sidebar-<?php echo $value; ?>" class="col-<?php echo $value; ?> sidebar right tb-height-balance tb-region tb-scope tb-sidebar tb-right tb-hidden">
                              <?php print render($page['sidebar_'.$value]); ?>
                            </div>

                    <?php endif; endforeach; endif; endif; ?> <!-- end sidebars -->
share|improve this question
    
Where are you adding that code? –  David Thomas Jan 7 '13 at 0:13
    
@DavidThomas This code is in page.tpl.php but the code is for d7 as you can see and I am trying to make it work for d6... This code makes the sidebar in a theme somehow go full length regardless of what the content length is and mine in d6 is not doing that so I'm not sure how I can do that with css either ? –  Altin Ukshini Jan 7 '13 at 1:03
    
an easier way to set the sidebar height is with CSS, e.g: #sidebar-left{ min-height: 800px; } –  David Thomas Jan 7 '13 at 1:11
    
@DavidThomas I don't want my sidebar to be fixed sized, it should be the same as the article in the left –  Altin Ukshini Jan 7 '13 at 2:27
add comment

1 Answer

up vote 0 down vote accepted

Functionality aside, I think the basic structure for D6 would be:

<?php
if(isset($sidebars['left'])):
  foreach($sidebars['left'] as $value):
    if (!empty(${'sidebar_'.$value})): ?>
    <div id="sidebar-<?php echo $value; ?>" class="col-<?php echo $value; ?> sidebar left tb-height-balance tb-region tb-scope tb-sidebar tb-left">
      <?php print ${'sidebar_'.$value}; ?>
    </div>
    <?php 
    endif; 
  endforeach; 
endif; ?>
share|improve this answer
add comment

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.