includes/clientside/static/template-compiler.js
changeset 1280 871f17a0d27d
parent 1269 35986c6b2150
child 1291 a971f6efcb7b
equal deleted inserted replaced
1279:0bc945385d74 1280:871f17a0d27d
    37 			compiled = eval(tpl_code);
    37 			compiled = eval(tpl_code);
    38 		}
    38 		}
    39 		catch(e)
    39 		catch(e)
    40 		{
    40 		{
    41 			alert(e);
    41 			alert(e);
       
    42 			load_component('acl');
    42 			aclDebug(tpl_code);
    43 			aclDebug(tpl_code);
    43 		}
    44 		}
    44 		return compiled;
    45 		return compiled;
    45 	}
    46 	}
    46 	return false;
    47 	return false;
    58 	code = code.replace(/\{lang:([a-z0-9_]+)\}/g, "' + $lang.get('$1') + '");
    59 	code = code.replace(/\{lang:([a-z0-9_]+)\}/g, "' + $lang.get('$1') + '");
    59 	code = code.replace(/\<!-- IFSET ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- BEGINELSE \1 --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( typeof(this.tpl_strings['$1']) == 'string' ) ? '$2' : '$3' ) + '");
    60 	code = code.replace(/\<!-- IFSET ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- BEGINELSE \1 --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( typeof(this.tpl_strings['$1']) == 'string' ) ? '$2' : '$3' ) + '");
    60 	code = code.replace(/\<!-- IFSET ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( typeof(this.tpl_strings['$1']) == 'string' ) ? '$2' : '' ) + '");
    61 	code = code.replace(/\<!-- IFSET ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( typeof(this.tpl_strings['$1']) == 'string' ) ? '$2' : '' ) + '");
    61 	code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- BEGINELSE \1 --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '$3' ) + '");
    62 	code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- BEGINELSE \1 --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '$3' ) + '");
    62 	code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '' ) + '");
    63 	code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '' ) + '");
       
    64 	code = code.replace(/\<!-- BEGINNOT ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == false ) ? '$2' : '' ) + '");
    63 	code = code.replace(/\<!-- HOOK ([A-z0-9_-]+) --\>/ig, "' + this.fetch_hook('$1') + '");
    65 	code = code.replace(/\<!-- HOOK ([A-z0-9_-]+) --\>/ig, "' + this.fetch_hook('$1') + '");
    64 	return code;
    66 	return code;
    65 }
    67 }
    66 
    68 
    67 window.__tpExtractVars = function(code)
    69 window.__tpExtractVars = function(code)