From ec8a84b6d64ab1c9f6e05e255013de3fda46b84e Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 17 Nov 2011 17:25:09 +0800 Subject: [PATCH] JsTemplate.php --- JsTemplate.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/JsTemplate.php b/JsTemplate.php index 1dc81bf9..2639bb22 100644 --- a/JsTemplate.php +++ b/JsTemplate.php @@ -56,14 +56,21 @@ class Pman_Core_JsTemplate extends Pman { $dir = dirname($mod) . '/jtemplates'; if (!file_exists($dir)) { echo '// missing directory '. htmlspecialchars($dir) ."\n"; + continue; } // got a directory.. $mn = basename(dirname($mod)); - + $ar = glob("$dir/*.html") ; + if (empty($ar)) { + echo '// no template is directory '. htmlspecialchars($dir) ."\n"; + continue; + } + echo "Pman.{$mn} = Pman.{$mn} || {};\n"; + echo "Pman.{$mn}.template = Pman.{$mn}.template || {};\n\n"; foreach(glob("$dir/*.html") as $fn) { - $name = 'Pman.' . $mn .'.' . preg_replace('/\.html$/i', '', basename($fn)); - echo $this->compile($fn, $name); + $name = 'Pman.' . $mn .'.template.' . preg_replace('/\.html$/i', '', basename($fn)); + echo $this->compile($fn, $name) . "\m"; } -- 2.39.2