JsTemplate.php
authorAlan Knowles <alan@akbkhome.com>
Thu, 17 Nov 2011 09:25:09 +0000 (17:25 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 17 Nov 2011 09:25:09 +0000 (17:25 +0800)
JsTemplate.php

index 1dc81bf..2639bb2 100644 (file)
@@ -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";
                 
 
             }