I want my front page to look like this, in this order:

Block A - Fixed content

Block B - Fixed content

Stories - as usual, each new story goes to the top of the heap.

I've created a new block for A and B in the content region, but the stories always come out at the top of the page, before Blocks A and B. I've tried putting the blocks in the header region, but they don't appear. Also, from a useability standpoint, shouldn't there be a system block called "stories" that can be controlled from the block administration?

Comments

styro’s picture

a lot of people seem to assume 'content' would appear above the content. I reckon there should be two content regions 'before content' and 'after content'.

But anyway, this should be relatively easy to solve...

With 4.7 you can create your own regions quite simply - see http://drupal.org/node/29139

Basically you just edit the region function in your theme or add it if it doesn't already exist. That allows the block config page to pick up that region in your theme for the pull down list of regions. Then you just have to add a small print statement to your page.tpl.php where you want the region to go.

eg this is a very rough example that I haven't tested - it won't work verbatim, don't just paste it into your theme...

In template.php, add the two regions to mytheme_regions (note mytheme should be replaced by the name of your theme)...

<?php
function mytheme_regions() {
  return array(
      'regiona' => t('Region A'),
      'regionb' => t('Region B'),
      'left' => t('left sidebar'),
      'right' => t('right sidebar'),
      'content' => t('content'),
      'header' => t('header'),
      'footer' => t('footer')
  );
}
?>

And print those regions where you want them (ie just before the content is printed, but after the mission and messages etc) in your page.tpl.php...

.... [other stuff snipped] ....
        <div class="regiona"><?php print($regiona) ?></div>
        <div class="regionb"><?php print($regionb) ?></div>
        <!-- start main content -->
        <?php print($content) ?>
        <!-- end main content -->
        </td><!-- mainContent -->
.... [other stuff snipped] ....

I put divs around them so you could style them differently from each other but that is up to you.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

Buckbeak’s picture

Cool, thanks, I'll try that. I heard on the Lullabot podcast that a future Drupal might let you create regions in the gui....

Buckbeak’s picture

It worked like a charm. Thanks.