Sub Sub LoadTemplate(sPath, sName) Dim nName if objFSO.FileExists(sPath) then DBlocks.Add sName, objFSO.OpenTextFile(sPath).ReadAll nName = NextDBlockName(sName) while not (nName = "") SetBlock sName, nName nName = NextDBlockName(sName) wend end if End Sub Function GetVar(sName) GetVar = DBlocks(sName) End Function Function SetVar(sName, sValue) if ParsedBlocks.Exists(sName) then ParsedBlocks(sName) = replace(replace(sValue, "{", "{"), "}", "}") else ParsedBlocks.add sName, replace(replace(sValue, "{", "{"), "}", "}") end if End Function Function Parse(sTplName, bRepeat) if ParsedBlocks.Exists(sTplName) then if bRepeat then ParsedBlocks(sTplName) = ParsedBlocks(sTplName) & ProceedTpl(DBlocks(sTplName)) else ParsedBlocks(sTplName) = ProceedTpl(DBlocks(sTplName)) end if else ParsedBlocks.add sTplName, ProceedTpl(DBlocks(sTplName)) end if End Function Function PrintVar(sName) PrintVar = ParsedBlocks(sName) End function Function ProceedTpl(sTpl) Dim regEx, sMatch, oMatches, sName, sTTpl sTTpl = sTpl sMatch = getNextPattern(sTTpl, 1) while len(sMatch) > 0 sName = mid(sMatch, 2, len(sMatch) - 2) if ParsedBlocks.Exists(sName) then sTTpl = replace(sTTpl, sMatch, ParsedBlocks(sName)) else sTTpl = replace(sTTpl, sMatch, DBlocks(sName)) end if sMatch = getNextPattern(sTTpl, 1) wend ProceedTpl = sTTpl End Function Function getNextPattern(str, begin) Dim res, b, e, isOk Dim ParsedBlocks.add sName, replace(replace(sValue, "{", "{"), "}", "}") end if End Function Function Parse(sTplName, bRepeat) if ParsedBlocks.Exists(sTplName) then if bRepeat then ParsedBlocks(sTplName) = ParsedBlocks(sTplName) & ProceedTpl(DBlocks(sTplName)) else ParsedBlocks(sTplName) = ProceedTpl(DBlocks(sTplName)) end if else ParsedBlocks.add sTplName, ProceedTpl(DBlocks(sTplName)) end if End Function Function PrintVar(sName) PrintVar = ParsedBlocks(sName) End function Function ProceedTpl(sTpl) Dim regEx, sMatch, oMatches, sName, sTTpl sTTpl = sTpl sMatch = getNextPattern(sTTpl, 1) while len(sMatch) > 0 sName = mid(sMatch, 2, len(sMatch) - 2) if ParsedBlocks.Exists(sName) then sTTpl = replace(sTTpl, sMatch, ParsedBlocks(sName)) else sTTpl = replace(sTTpl, sMatch, DBlocks(sName)) end if sMatch = getNextPattern(sTTpl, 1) wend ProceedTpl = sTTpl End Function Function getNextPattern(str, begin) Dim res, b, e, isOk Dim w(5) b = instr(begin, str, "{") if b > 0 then e = instr(b, str, "}") w(1) = instr(b, str, " ") w(2) = instr(b, str, ";") w(3) = instr(b, str, ":") w(4) = instr(b, str, "=") w(5) = instr(b, str, "(") isOk = true For i = 1 to 5 if w(i) < e and w(i) > b then isOk = false Next if isOk then res = mid(str, b, e - b + 1) else res = getNextPattern(str, e) end if else res = "" end if getNextPattern = res End Function Function getBlock(sTemplate, sName) Dim BBloc, EBlock, alpha alpha = len(sName) + 12 BBlock = instr(sTemplate, "") EBlock = instr(sTemplate, "") if not (BBlock = 0 or EBlock = 0) then getBlock = mid(sTemplate, BBlock + alpha, EBlock - BBlock - alpha) else getBlock = "" end if End Function Function replaceBlock(sTemplate, sName) Dim BBloc, EBlock BBlock = instr(sTemplate, "") EBlock = instr(sTemplate, "") if not (BBlock = 0 or EBlock = 0) then replaceBlock = left(sTemplate, BBlock - 1) & "{" & sName & "}" & right(sTemplate, len(sTemplate) - EBlock - len("") + 1) else replaceBlock = sTemplate end if end function Function NextDBlockName(sTemplateName) dim BTag, ETag, sName, sTemplate sTemplate = DBlocks(sTemplateName) BTag = instr(sTemplate, "") sName = Mid(sTemplate, BTag + 9, ETag - (BTag + 9)) if instr(sTemplate, "") > 0 then NextDBlockName = sName else NextDBlockName = "" end if else NextDBlockName = "" end if End function 'Print all Dynamic Variables Function PrintAll() dim aPBlocks dim aDBlocks dim i, res aPBlocks = ParsedBlocks.Items aDBlocks = DBlocks.Items res = "" for i = 1 to UBound(aDBlocks) res = res & "" next for i = 1 to UBound(aPBlocks) res = res & "" next res = res & "
" & ToHTML(aDBlocks(i)) & "
" & ToHTML(aPBlocks(i)) & "
" PrintAll = res End Function %> Property company in Delhi India,Indian Buy Sell Rent Real Estate in Delhi India, Property in Delhi India, No.1 Real Estate Service Provider, Properties based in Delhi India Investment property sensex