=== modified file 'themes/engines/phptemplate/phptemplate.engine'
--- themes/engines/phptemplate/phptemplate.engine	2006-10-23 06:45:17 +0000
+++ themes/engines/phptemplate/phptemplate.engine	2006-11-17 20:34:17 +0000
@@ -24,13 +24,15 @@ function phptemplate_templates($director
  *  An array of regions. The first array element will be used as the default region for themes.
  */
 function phptemplate_regions() {
-  return array(
+  $variables['regions'] = array(
        'left' => t('left sidebar'),
        'right' => t('right sidebar'),
        'content' => t('content'),
        'header' => t('header'),
        'footer' => t('footer')
   );
+  $variables = _phptepmplate_load_variables('regions', $variables);
+  return $variables['regions'];
 }
 
 /**
@@ -56,12 +58,7 @@ function _phptemplate_callback($hook, $v
   global $theme_engine;
 
   $variables = array_merge($variables, _phptemplate_default_variables($hook, $variables));
-
-  // Allow specified variables to be overridden
-  $variables_function = '_'. $theme_engine .'_variables';
-  if (function_exists($variables_function)) {
-    $variables = array_merge($variables, call_user_func($variables_function, $hook, $variables));
-  }
+  $variables = _phptepmplate_load_variables($hook, $variables);
 
   if (is_array($variables['template_files'])) {
     $suggestions = array_merge($suggestions, $variables['template_files']);
@@ -83,6 +80,26 @@ function _phptemplate_callback($hook, $v
 }
 
 /**
+ * Allow specified variables to be overridden
+ *
+ * @param $hook
+ *   The name of the theme function being executed.
+ * @param $variables
+ *   An associate array of variables passed to be overwritten.
+ * @return
+ *   An associate array of variables ready to be passed to templates.
+ */
+function _phptemplate_load_variables($hook, $variables) {
+  global $theme_engine;
+
+  $variables_function = '_'. $theme_engine .'_variables';
+  if (function_exists($variables_function)) {
+    $variables = array_merge($variables, call_user_func($variables_function, $hook, $variables));
+  }
+  return $variables;
+}
+
+/**
  * Adds additional helper variables to all templates.
  *
  * Counts how many times certain hooks have been called. Sidebar left / right are special cases.

=== modified file 'themes/garland/template.php'
--- themes/garland/template.php	2006-11-07 12:09:09 +0000
+++ themes/garland/template.php	2006-11-17 20:40:40 +0000
@@ -54,19 +54,27 @@ function phptemplate_comment_wrapper($co
  * Override or insert PHPTemplate variables into the templates.
  */
 function _phptemplate_variables($hook, $vars) {
-  if ($hook == 'page') {
+  switch ($hook) {
+    case 'page':
+      if ($secondary = menu_secondary_local_tasks()) {
+        $output = '<span class="clear"></span>';
+        $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
+        $vars['tabs2'] = $output;
+      }
 
-    if ($secondary = menu_secondary_local_tasks()) {
-      $output = '<span class="clear"></span>';
-      $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
-      $vars['tabs2'] = $output;
-    }
-
-    // Hook into color.module
-    if (module_exists('color')) {
-      _color_page_alter($vars);
-    }
-    return $vars;
+      // Hook into color.module
+      if (module_exists('color')) {
+        _color_page_alter($vars);
+      }
+      return $vars;
+    case 'regions':
+      $vars['regions'] = array(
+       'left' => t('left sidebar'),
+       'right' => t('right sidebar'),
+       'content' => t('content'),
+       'footer' => t('footer'),
+      );
+      return $vars;
   }
   return array();
 }

