}
- function get()
+ function get($v, $opts=array())
{
+
+ $this->sessionState(0);
// get the modules.
header('Content-type: text/javascript');
$ff = HTML_FlexyFramework::get();
$pr = $ff->project;
- $ar = explode(PATH_SEPARATOR, $ff->HTML_Template_Flexy['templateDir']);
- $prefix = $pr == 'Pman' ? 'Pman.' : '';
+ $mods = $this->modulesList();
+ //print_r($mods);
+
+ //$ar = explode(PATH_SEPARATOR, $ff->HTML_Template_Flexy['templateDir']);
+ array_push($mods, $pr);
- foreach($ar as $mod) {
- $dir = dirname($mod) . '/jtemplates';
+ foreach($mods as $mod )
+ {
+ $prefix = $mod == $pr ? "" : "{$pr}.";
+ //var_dump($prefix);
+ $pdir = $mod == $pr ? '' : ($pr .'/') ;
+
+ $dir = $this->rootDir .'/'.$pdir . $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 "{$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";
$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..?
continue;
case ($inscript && ($item != '{end:}')):
- $ret[] = $item;
+ $ret[count($ret)-1] .= $item;
continue;
case ($inscript && ($item == '{end:}')):
case ($item == '{script:}'):
$inscript = true;
+ $ret[] = '';
continue;
case ($item[1] == '!'):
$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);
}
$in = str_repeat(" ", $indent);
- $ret[] = $in . "return ret);\n}\n";
+ $ret[] = $in . "return ret;\n}\n";
return $head . implode("\n",$funcs) . "\n\n" .implode("\n",$out) ;
//echo '<PRE>' . htmlspecialchars(implode("\n",$ret));