By totocol on
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
Check your variable names
You should be checking for and printing
postscript_first, postscript_middle, and postscript_lastnotfooter_first, footer_middle, and footer_lastI didn't test, but try this:
--
Shawn Gregg
gmndesign.com - portfolio
shalosophy.com - blog
Postcript is another region
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:
Thanks again, any suggestion is welcome.
Raul
raulcaceres.me
Ok so if I understand
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:
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
Already added regions in .info file
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
Raul
raulcaceres.me
Hi Raul
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:
If that doesn't work I can always take a look at the code for you if the site is publicly accessable.
- Shawn
Thanks
Thanks a lot Shawn.
I'll give it a try and report back.
Thanks again,
Raul
Raul
raulcaceres.me