hello all - I'm stuck and need a little help. I've created a couple new regions for my custom theme, but for some reason they're not appearing when I go to my "blocks" page for selectable regions.

here is how they're added in my .info file:

region[new_top] = new top
region[new_bottom] = new bottom

and here they are in my page.tpl.php file


<?php if ($new_top): ?>
	<div id="new_top">
	<?php print theme(new-top', $new_top); ?>
	</div>
	<?php endif; ?>

<?php if ($new_bottom): ?>
	<div id="new_bottom">
	<?php print theme('new-bottom', $new_bottom); ?>
	</div>
	<?php endif; ?>

I'm new to php so I'm not sure if I'm missing something or I've done something wrong, but I just can't figure out what's going on. and FWIW all the other regions are working fine. I've cleared the cache too. Stumped. Am I missing something?

Thanks in advance

Comments

Jeff Burnz’s picture

Well...

Normally you just print a region, eg.

<?php if ($new_bottom): ?>
  <div id="new_bottom">
    <?php print $new_bottom; ?>
  </div>
<?php endif; ?>
roborracle’s picture

I've tried it both ways and I can't seem to figure it out.

just tinkering with the .info file to see if I missed something, and removed the underscore

region[newtop] = new top
region[newbottom] = new bottom
	<!-- REGION: NEW-TOP -->
	<?php if ($newtop): ?>
	<div id="newtop">
	<?php print $newtop; ?>
	</div>
	<?php endif; ?>
		
	<!-- REGION: NEW-BOTTOM -->
		
	<?php if ($newbottom): ?>
	<div id="newbottom">
	<?php print $newbottom; ?>
	</div>
	<?php endif; ?>

scratching my head on this one...

Jeff Burnz’s picture

OK, lets be clear, your first example in the OP is rubbish PHP, the way I showed you is the default way of printing a region.

Underscores make no difference - they are legal in region names and variables.

Mu guess is that since you are not seeing them show up on the blocks page is that you are making a very simple error:

1. not clearing the theme registry correctly (visiting the themes page or use clear cache data on the Performance settings page)
2. You are not saving/uploading the info file correctly

Not a lot can go wrong here mate, its pretty simple stuff.

roborracle’s picture

figured it out - there was a problem with my regions in my .info file.

thanks again.