sp; 'by sending each line to ParseTMPL()
if g_bFILE then
Dim l_sLine
for each l_sLine in l_arrFile
ParseTMPL(l_sLine)
next
else
'Error File Not Found!
end if
end sub
private sub ParseTMPL(inLine)
'This is a reasonably complex piece of code that looks for any text that is bounded by '[%' and '%]'...
'If it finds one it takes the first part of the line up to the '[%' and displays it to the user.
'It then passes the bounded text to getToken.
'The it send the text that resides past the '%]' to itself(ParseTMPL), that way it can check for another
'token on the same line.
'If the routine doesn't find a '[%' in the line it simply displays it for the user.
dim l_ia, l_ib, l_sLine, l_sLine2, l_sToken
l_ia = instr(inLine, "][%")
if l_ia > 0 then
l_sLine = left(inLine, l_ia - 1)
l_ib = instr(inLine, "%]")
l_sLine2 = mid(inLine, l_ib + 2)
l_sToken = trim(mid(inLine, l_ia + 2, (l_ib - l_ia - 2)))
Response.Write(l_sLine & VbCrLf)
getToken(l_sToken)
ParseTMPL(l_sLine2)
else
Response.Write(inLine & VbCrLf)
end if
end sub
private sub getToken(inToken)
 
if g_bFILE then
Dim l_sLine
for each l_sLine in l_arrFile
ParseTMPL(l_sLine)
next
else
'Error File Not Found!
end if
end sub
private sub ParseTMPL(inLine)
'This is a reasonably complex piece of code that looks for any text that is bounded by '[%' and '%]'...
'If it finds one it takes the first part of the line up to the '[%' and displays it to the user.
'It then passes the bounded text to getToken.
'The it send the text that resides past the '%]' to itself(ParseTMPL), that way it can check for another
'token on the same line.
'If the routine doesn't find a '[%' in the line it simply displays it for the user.
dim l_ia, l_ib, l_sLine, l_sLine2, l_sToken
l_ia = instr(inLine, "][%")
if l_ia > 0 then
l_sLine = left(inLine, l_ia - 1)
l_ib = instr(inLine, "%]")
l_sLine2 = mid(inLine, l_ib + 2)
l_sToken = trim(mid(inLine, l_ia + 2, (l_ib - l_ia - 2)))
Response.Write(l_sLine & VbCrLf)
getToken(l_sToken)
ParseTMPL(l_sLine2)
else
Response.Write(inLine & VbCrLf)
end if
end sub
private sub getToken(inToken)
 
| 对此文章发表了评论 |
