I want to add a shoutbox and have it come above the news on the front page.

I read the guideline on regions, but I seem to be doing something wrong.

I added regions[content_top] = Content Top to the .info file, above the features. I wasn't sure if I need to add ALL the regions, though, since they're not listed.

Then I tried adding this code to the page.tpl.php file: <?php if ($content_top) echo '<div class="content_top">' . $content_top . "</div>";

I tried adding this before <div id="centre"> and it threw a syntax error, so I tried it before <?php if ($title): ?>

What am I doing wrong?

Comments

Nosfe’s picture

I think when I added my Top content Region, I had to add all original regions too:

regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
regions[topcontent] = Top of Content

Then I added my new region just above content like this:

         <div class="topcontent">
           <?php print $topcontent; 

<? print $content; ?>
?>

I think you hav a syntax error because you forgot : in if ($content_top) senetce should be like this:

if ($content_top): echo '<div class="content_top">' . $content_top . "</div>"; 

And remember to rebuild theme registry .

zenrei’s picture

Thank you.

I will give that a try.

I do appreciate your help!

zenrei’s picture

Ok,

I got it to work! Thank you SO much, Nosfe for pointing me in the right direction!

This is exactly what I did.

I added all regions to the .info file (because I'm weird like that, I added them between features and stylesheets (to make it alphabetical) :):

regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
regions[topcontent] = Top of Content

After that, I added the following code to the page.tpl.php file:

      <?php if ($topcontent): ?>
         <div class="topcontent"><?php print $topcontent ?></div>
      <?php endif ?>

I added the above code in between

      <?php print $help ?>

and

      <?php print $content ?>

I then cleared the cache... and viola! there it was! and it actually WORKED! *gasp!*

zenrei’s picture

Status: Active » Closed (fixed)
zenrei’s picture

Title: adding "content_top" region » adding "topcontent" region (content top)