Hi everyone,

I'm trying to add a new region with three columns. Specifically, I'm trying to do this in the footer. I'm doing it by copying code from other places as I'm not an expert on this so I'm not sure what I am missing.

I added the three columns in the theme.info file

regions[postscript_first] = postscript first
regions[postscript_middle] = postscript middle
regions[postscript_last] = postscript last

and then I added this code to the page.tpl.php file

<?php if ($footer_first || $footer_middle || $footer_last): ?>
    <div id="footer-wrapper" class="<?php print $footers; ?> clearfix">
      <?php if ($footer_first): ?>
      <div id="footer-first" class="column">
        <?php print $footer_first; ?>
      </div><!-- /footer-first -->
      <?php endif; ?>

      <?php if ($footer_middle): ?>
      <div id="footer-middle" class="column">
        <?php print $footer_middle; ?>
      </div><!-- /footer-middle -->
      <?php endif; ?>

      <?php if ($postscript_last): ?>
      <div id="footer-last" class="column">
        <?php print $footer_last; ?>
      </div><!-- /footer-last -->
      <?php endif; ?>
    </div><!-- /footer-wrapper -->
    <?php endif; ?>

My first feelings are that since I am adding footer-wrapper then I need to add some styling so that it works?, also that the problem is probably on the second line <div id="footer-wrapper" class="<?php print $footers; ?> clearfix">

- Do I need to define anything else in any other file or just with this code it should work well?

Any help would be greatly appreciated

Comments

shawn.sh’s picture

You should be checking for and printing postscript_first, postscript_middle, and postscript_last not footer_first, footer_middle, and footer_last

I didn't test, but try this:


<?php if ($postscript_first || $postscript_middle || $postscript_last): ?>
    <div id="footer-wrapper" class="<?php print $footers; ?> clearfix">
      <?php if ($postscript_first): ?>
      <div id="footer-first" class="column">
        <?php print $postscript_first; ?>
      </div><!-- /footer-first -->
      <?php endif; ?>

      <?php if ($postscript_middle): ?>
      <div id="footer-middle" class="column">
        <?php print $postscript_middle; ?>
      </div><!-- /footer-middle -->
      <?php endif; ?>

      <?php if ($postscript_last): ?>
      <div id="footer-last" class="column">
        <?php print $postscript_last; ?>
      </div><!-- /footer-last -->
      <?php endif; ?>
    </div><!-- /footer-wrapper -->
    <?php endif; ?>


--
Shawn Gregg

gmndesign.com - portfolio
shalosophy.com - blog

totocol’s picture

Thanks shalosophy,

I'm just a bit confused because there is a postscript region with three columns postscript_first middle and last so they are already printed before. Maybe I'm just missing something.

I also made a small mistake with the code I posted, the right code is:

<?php if ($footer_first || $footer_middle || $footer_last): ?>
    <div id="footer-wrapper" class="<?php print $footers; ?> clearfix">
      <?php if ($footer_first): ?>
      <div id="footer-first" class="column">
        <?php print $footer_first; ?>
      </div><!-- /footer-first -->
      <?php endif; ?>

      <?php if ($footer_middle): ?>
      <div id="footer-middle" class="column">
        <?php print $footer_middle; ?>
      </div><!-- /footer-middle -->
      <?php endif; ?>

      <?php if ($footer_last): ?>
      <div id="footer-last" class="column">
        <?php print $footer_last; ?>
      </div><!-- /footer-last -->
      <?php endif; ?>
    </div><!-- /footer-wrapper -->
    <?php endif; ?>

Thanks again, any suggestion is welcome.

shawn.sh’s picture

Ok so if I understand correctly you already have the 3 postscript regions (postscript_first, postscript_middle, and postscript_last) printed in your page.tpl.php file and you'll like to add 3 more, this time in the footer. In order to do this you'll have to create 3 new regions in the theme.info file like you did with the 3 postscript regions.

So for the code above to work you'll have to create the regions below:

regions[footer_first] = footer first
regions[footer_middle] = footer middle
regions[footer_last] = footer last

So it's not really a 3 column region, it's more like 3 different reigions layed out in 3 different columns.

I hope this helps...

--
Shawn Gregg

gmndesign.com - portfolio
shalosophy.com - blog

totocol’s picture

Hi Shawn,

Thanks again for your help. yes, you are right, they are three regions layed out in three different columns (still find some of the language confusing). As you can see at the top of the thread I also added the regions in the .info file. With the code I presented the 3 regions appear but not as columns but as three regions one after the other.

Any ideas on how to get them to behave as columns?

Thanks a lot for your help again.

Raul

shawn.sh’s picture

No problem Raul, I'm sorry if I didn't fully understand that you were confused about. You'll have to use CSS to make the columns appear side by side.

Try giving each region div a width and float them to the left.

Something like this in your css:

.column {float:left; width:200px;}

If that doesn't work I can always take a look at the code for you if the site is publicly accessable.

- Shawn

totocol’s picture

Thanks a lot Shawn.

I'll give it a try and report back.

Thanks again,

Raul