X-Git-Url: https://git.bts.cx/garden.git/blobdiff_plain/2812e275ef0f68ae484ec50fd954dd88225a2532..refs/heads/main:/garden.php diff --git a/garden.php b/garden.php index 99cb012..8c01277 100644 --- a/garden.php +++ b/garden.php @@ -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];