X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=JsTemplate.php;h=f1387913c57aa7251c3a593c07d4f5afd314b684;hp=cf18764f798b20ea60a8dc870a6c73cfc9aa4eb8;hb=refs%2Fheads%2Fwip_alan_T5884_add_photo_to_report;hpb=c736cf71224794a6ce873bddc474e74a5c97c979 diff --git a/JsTemplate.php b/JsTemplate.php index cf18764f..f1387913 100644 --- a/JsTemplate.php +++ b/JsTemplate.php @@ -40,10 +40,12 @@ class Pman_Core_JsTemplate extends Pman { } - function get() + function get($v, $opts=array()) { + + $this->sessionState(0); // get the modules. - //header('Content-type: text/javascript'); + header('Content-type: text/javascript'); $ff = HTML_FlexyFramework::get(); @@ -58,7 +60,7 @@ class Pman_Core_JsTemplate extends Pman { foreach($mods as $mod ) { $prefix = $mod == $pr ? "" : "{$pr}."; - var_dump($prefix); + //var_dump($prefix); $pdir = $mod == $pr ? '' : ($pr .'/') ; $dir = $this->rootDir .'/'.$pdir . $mod . '/jtemplates'; @@ -67,18 +69,18 @@ class Pman_Core_JsTemplate extends Pman { continue; } // got a directory.. - $mn = $mod; + $ar = glob("$dir/*.html") ; if (empty($ar)) { echo '// no template is directory '. htmlspecialchars($dir) ."\n"; continue; } - echo "{$prefix}{$mn} = {$prefix}{$mn} || {};\n"; - echo "{$prefix}{$mn}.template = {$prefix}{$mn}.template || {};\n\n"; + echo "{$prefix}{$mod} = {$prefix}{$mod} || {};\n"; + echo "{$prefix}{$mod}.template = {$prefix}{$mod}.template || {};\n\n"; foreach(glob("$dir/*.html") as $fn) { - $name = "{$prefix}{$mn}.template." . preg_replace('/\.html$/i', '', basename($fn)); + $name = "{$prefix}{$mod}.template." . preg_replace('/\.html$/i', '', basename($fn)); echo $this->compile($fn, $name) . "\n"; @@ -111,7 +113,7 @@ class Pman_Core_JsTemplate extends Pman { $out= array(); - $head = "$name = function(t)\n{\n var ret = [];\n\n"; + $head = "$name = function(t)\n{\n var ret = '';\n\n"; $funcs = array(); // do not allow nested functions..?