[dev] [patch] Giapeto template handling

Roel Gloudemans roel at gloudemans.info
Tue Sep 13 09:29:19 PDT 2005


The "store Templates in VFS" patch from a few weeks ago broke template handling.
Before, the template name was stored in the datatree. Now the number of the
element in the template array is stored.

When retrieving the template, the template name is expected (as was the behavoir
before VFS), not some array ID. This patch fixes this.

Cheers,
Roel.
-------------- next part --------------
--- Giapeto.php.org	2005-09-13 18:01:45.000000000 +0200
+++ Giapeto.php	2005-09-13 18:17:46.000000000 +0200
@@ -363,8 +363,14 @@
             return $templates;
         }
 
-        $templates = array_keys($templates);
-        asort($templates);
+        $template_names = array_keys($templates);
+        asort($template_names);
+
+        $templates = array();
+        foreach($template_names as $template_name) {
+            $templates[$template_name] = $template_name;
+        }
+
         return $templates;
     }
 
@@ -392,6 +398,7 @@
             if (is_a($templates, 'PEAR_Error')) {
                 Horde::fatal($templates, __FILE__, __LINE__, true);
             }
+            $templates = array_values($templates);
             $template = $templates[0];
         }
         return $template;


More information about the dev mailing list