]> git.bts.cx Git - garden.git/blobdiff - garden.php
Some small template fixes
[garden.git] / garden.php
index 99cb0123ac8f07091403252717e70e4058d05b80..8c0127705962891ee05cda45655bfa0539462977 100644 (file)
@@ -260,7 +260,11 @@ function garden_template_render($name, $variables = null) {
        $output = '';
        while ($name != null) {
                $path = garden_path(GARDEN_TEMPLATE_DIR, $name . '.php');
-               
+
+               if (file_exists($path) == false) {
+                       $path = garden_path(GARDEN_FALLBACK_TEMPLATE_DIR, $name . '.php');
+               }
+
                $base_template = null;
                $base_template_variables = null;
 
@@ -312,8 +316,6 @@ function garden_site_url(...$url_segments) {
        return GARDEN_SITE_BASE_URL . garden_url(...$url_segments);
 }
 
-
-
 ///////////////////////////////////////////////////////////////////////////////
 // Images
 ///////////////////////////////////////////////////////////////////////////////
@@ -527,7 +529,14 @@ function garden_generate_atom($output_directory, $output_filename, $content_item
                        continue;
                }
 
-               $recent_items[$item->date] = $item;
+               $date_key = $item->date;
+
+               // Hack to support sorting without missing entries
+               while (isset($recent_items[$date_key])) {
+                       $date_key += 1;
+               }
+
+               $recent_items[$date_key] = $item;
        }
 
        // Sort by date...
@@ -605,6 +614,8 @@ function garden() {
 assert(extension_loaded('imagick'), 'Needs Imagick');
 assert($argc >= 2, 'Please provide configuration file');
 
+define('GARDEN_FALLBACK_TEMPLATE_DIR', garden_path(__DIR__, 'templates'));
+
 // First parameter needs to be the configuration php
 $config_file = $argv[1];