Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By baronmunchowsen on
Hi all,
I have read this post (http://drupal.org/node/29139) and created 2 custom regions using the code below in my template.php file:
<?php
function baron_regions() {
return array(
'right' => t('right sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
'subcontent-a' => t('subcontent-a'),
'subcontent-b' => t('subcontent-b')
);
}
?>
I have included the new custom regions in my page.tpl.php file:
<div id="subcontent-a">hello<?php print $subcontent-a; ?></div>
<div id="subcontent-b">world<?php print $subcontent-b; ?></div>
When I go to administer -> blocks, the new regions are available in the drop-down menus. However!
- My regions do not show up on the administer -> blocks page like the other regions do (a shaded area saying for example: 'right sidebar'). There are no shaded areas saying 'subcontent-a' or 'subcontent-b' to show where they are on the page, as I assumed there would be.
- When I assign a block to the region, it does not appear.
Can anyone suggest where I have gone wrong? I can't seem to find it. I'm using Drupal 4.7.4.
Thanks for any help!
Comments
SOLUTION
Okay - 2 seconds after I posted the above it came to me:
For some reason I thought you could stick a hyphen in variable names! Where did I come up with that?!!!???
Too many late nights...
I changed all of
$subcontent-a
to
$subcontenta
and it's all good.
I am a plonker.
Kids, don't do drugs. They mess you up.