JsTemplate.php
[Pman.Core] / JsTemplate.php
index 0e8d3bd..82defd2 100644 (file)
@@ -48,6 +48,10 @@ class Pman_Core_JsTemplate extends Pman {
         $ff = HTML_FlexyFramework::get();
         
         $pr = $ff->project;
+        
+        $mods = $this->modulesList();
+        print_r($mods);
+        
         $ar = explode(PATH_SEPARATOR, $ff->HTML_Template_Flexy['templateDir']);
         
         $prefix = $pr == 'Pman' ? 'Pman.' : '';
@@ -120,7 +124,7 @@ class Pman_Core_JsTemplate extends Pman {
                     continue;
                 
                 case ($inscript && ($item != '{end:}')):
-                    $ret[= $item;
+                    $ret[count($ret)-1] .= $item;
                     continue;
                 
                 case ($inscript && ($item == '{end:}')):
@@ -138,6 +142,7 @@ class Pman_Core_JsTemplate extends Pman {
                 
                 case ($item == '{script:}'): 
                     $inscript = true;
+                     $ret[] = '';
                     continue;
                 
                 case ($item[1] == '!'):
@@ -150,6 +155,13 @@ class Pman_Core_JsTemplate extends Pman {
                     $indent++;
                     continue;
                 
+                case (substr($item,1,5) == 'else:'):
+                    $indent--;
+                    $in = str_repeat("    ", $indent);
+                    $ret[] = $in . "} else { ";
+                    $indent++;
+                    continue;
+                 
                 case (substr($item,1,4) == 'end:'):
                     $indent--;
                     $in = str_repeat("    ", $indent);
@@ -181,7 +193,7 @@ class Pman_Core_JsTemplate extends Pman {
                         continue;
                     }
                     if (substr($item,-3,2) == ':b') {
-                        $ret[] = $in . "ret += Roo.util.Format.htmlEncode(".  substr($item,1,-1).').split("\n").join("<br/>\n");';
+                        $ret[] = $in . "ret += Roo.util.Format.htmlEncode(".  substr($item,1,-3).').split("\n").join("<br/>\n");';
                         continue;
                     }
                     $ret[] = $in . "ret += Roo.util.Format.htmlEncode(".  substr($item,1,-1).');';
@@ -192,7 +204,7 @@ class Pman_Core_JsTemplate extends Pman {
             
         }
         $in = str_repeat("    ", $indent);
-        $ret[] = $in .  "return ret.join('');\n}\n";
+        $ret[] = $in .  "return ret;\n}\n";
         return $head . implode("\n",$funcs) . "\n\n" .implode("\n",$out) ;
         //echo '<PRE>' . htmlspecialchars(implode("\n",$ret));