All pastes #251141 Raw Edit

Mine

public text v1 · immutable
#251141 ·published 2006-11-17 20:25 UTC
rendered paste body
=== 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:24:11 +0000
@@ -24,13 +24,14 @@ 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')
   );
+  return _phptepmplate_load_variables('regions', $variables);
 }

 /**
@@ -55,13 +56,7 @@ function phptemplate_regions() {
 function _phptemplate_callback($hook, $variables = array(), $suggestions = array()) {
   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']);
@@ -82,6 +77,19 @@ function _phptemplate_callback($hook, $v

 }

+function _phptemplate_load_variables($hook, $variables) {
+  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));
+  }
+  return $variables;
+}
+
 /**
  * Adds additional helper variables to all templates.
  *