From 1364fcadf3a41777133a8d7c516f03b612ebf99d Mon Sep 17 00:00:00 2001 From: Leo Koppelkamm Date: Thu, 26 May 2011 20:46:23 +0200 Subject: [PATCH 1/2] When looking for template, don't just pick first one, but test if it is a template file. Otherwise there will be problems with additional .txt files --- app/asset-types/page.inc.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/asset-types/page.inc.php b/app/asset-types/page.inc.php index 50379a59..25f89233 100644 --- a/app/asset-types/page.inc.php +++ b/app/asset-types/page.inc.php @@ -58,8 +58,16 @@ static function template_type($template_file) { static function template_name($file_path) { $txts = array_keys(Helpers::list_files($file_path, '/\.txt$/')); - # return first matched .txt file - return (!empty($txts)) ? preg_replace('/\.txt$/', '', $txts[0]) : false; + $template = ''; + #Walk trough txts and find template + foreach ($txts as $txt) { + $file = preg_replace('/\.txt$/', '', $txt); + if (Page::template_file($file) != false) { + $template = $file; + break; + } + } + return (!empty($template)) ? $template : false; } static function template_file($template_name) { From 33ac9a65d37ccfabf671ef060e27a82e57a8dabb Mon Sep 17 00:00:00 2001 From: Leo Koppelkamm Date: Thu, 26 May 2011 20:09:11 +0200 Subject: [PATCH 2/2] Tiny indent fix --- app/page-data.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/page-data.inc.php b/app/page-data.inc.php index c3ffd83a..d667e600 100644 --- a/app/page-data.inc.php +++ b/app/page-data.inc.php @@ -152,7 +152,7 @@ static function create_collections($page) { # $root $page->root = Helpers::list_files('./content', '/^\d+?\./', true); # $parent - $parent_path = self::get_parent($page->file_path, $page->url_path); + $parent_path = self::get_parent($page->file_path, $page->url_path); $page->parent = $parent_path; # $parents $page->parents = self::get_parents($page->file_path, $page->url_path);