[support] left and right sidebar naming consistency

sander-martijn sander at sander-martijn.com
Sun Aug 26 01:27:52 UTC 2007


Can someone explain if there's a reason why the left and right sidebar 
code for templates doesn't function in the same way the rest of the 
templating system does?

there is, in phptemplate.engine the following code which defines the 
regions:
function phptemplate_regions() {
  return array(
       'left' => t('left sidebar'),
       'right' => t('right sidebar'),
       'content' => t('content'),
       'header' => t('header'),
       'footer' => t('footer')
  );
}

Left side is how you refer to it in code, right side is how it displays 
in admin screens.  makes perfect sense.  If  you want to add custom 
regions, you put a block like this in your template.php:

function mytheme_regions(){
  return array(
       'left' => t('left sidebar'),
       'right' => t('right sidebar'),
       'content' => t('content'),
       'header' => t('header'),
       'footer' => t('footer'),
       'frontnews' => t('home page news'),
       'frontteaser' => t('home page teaser'),
       'frontlocate' => t('home page locate'),
       'subnav' =>t('Sub Navigation')
  );
}


Works the same way.  got it. 

now when i first started working through this i didn't understand any of 
that and used other templates and the pro book to start my template, 
including my left nav, so I didn't realize this inconsistency until now 
when I went to drop in a right nav:
<?php print $right ?>
nope, doesn't work.  I double checked my code (yes, it says right) and 
ran a whole lot of tests before I realized that my left nav was put in 
differently as well:
<?php print $sidebar_left ?> and finally tried <?php print 
$sidebar_right ?> which works.

While my problem is solved my frustration at this sudden inconsistency 
in the system design has not gone away.  I'm hoping someone can help me 
out by explaining why this exists like this.  Why does it not say 
sidebar_left and sidebar_right in the regions definition?  If those two 
are special and built into the system why are left and right in the 
region definition at all but don't show up as a duplicate option in the 
blocks list?

Inquiring minds would like to know.

.s


More information about the support mailing list