Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.370
diff -u -p -r1.370 theme.inc
--- includes/theme.inc	23 Aug 2007 16:41:19 -0000	1.370
+++ includes/theme.inc	24 Aug 2007 01:36:35 -0000
@@ -231,7 +231,7 @@ function _theme_process_registry(&$cache
       $result[$hook]['theme path'] = $path;
       // if function and file are left out, default to standard naming
       // conventions.
-      if (!isset($info['file']) && !isset($info['function'])) {
+      if (!isset($info['template']) && !isset($info['function'])) {
         $result[$hook]['function'] = ($type == 'module' ? 'theme_' : $name .'_') . $hook;
       }
       // If a path is set in the info, use what was set. Otherwise use the
@@ -240,6 +240,9 @@ function _theme_process_registry(&$cache
       if (isset($info['file']) && !isset($info['path'])) {
         $result[$hook]['file'] = $path .'/'. $info['file'];
       }
+      if (isset($info['template']) && !isset($info['path'])) {
+        $result[$hook]['template'] = $path .'/'. $info['template'];
+      }
       // If 'arguments' have been defined previously, carry them forward.
       // This should happen if a theme overrides a Drupal defined theme
       // function, for example.
@@ -492,16 +495,16 @@ function theme() {
   // point path_to_theme() to the currently used theme path:
   $theme_path = $hooks[$hook]['theme path'];
 
+  // Include a file if the theme function or preprocess function is held elsewhere.
+  if (!empty($info['file'])) {
+    $include_file = $info['file'];
+    if (isset($info['path'])) {
+      $include_file = $info['path'] .'/'. $include_file;
+    }
+    include_once($include_file);
+  }
   if (isset($info['function'])) {
     // The theme call is a function.
-    // Include a file if this theme function is held elsewhere.
-    if (!empty($info['file'])) {
-      $function_file = $info['file'];
-      if (isset($info['path'])) {
-        $function_file = $info['path'] .'/'. $function_file;
-      }
-      include_once($function_file);
-    }
     $output = call_user_func_array($info['function'], $args);
   }
   else {
@@ -566,7 +569,7 @@ function theme() {
     }
 
     if (empty($template_file)) {
-      $template_file = $hooks[$hook]['file'] . $extension;
+      $template_file = $hooks[$hook]['template'] . $extension;
       if (isset($hooks[$hook]['path'])) {
         $template_file = $hooks[$hook]['path'] .'/'. $template_file;
       }
@@ -678,7 +681,7 @@ function drupal_find_theme_templates($ca
     $hook = strtr($template, '-', '_');
     if (isset($cache[$hook])) {
       $templates[$hook] = array(
-        'file' => $template,
+        'template' => $template,
         'path' => dirname($file->filename),
       );
     }
@@ -698,7 +701,7 @@ function drupal_find_theme_templates($ca
           $file = substr($match, 0, strpos($match, '.'));
           // Put the underscores back in for the hook name and register this pattern.
           $templates[strtr($file, '-', '_')] = array(
-            'file' => $file,
+            'template' => $file,
             'path' => dirname($files[$match]->filename),
             'arguments' => $info['arguments'],
           );
