动态include的问题
Function include(filename)
Dim re,content,fso,f,ASPStart,ASPEnd
set fso=CreateObject( "Scripting.FileSystemObject ")
'filename=LEFT(Server.Mappath(Request.ServerVariables( "PATH_INFO ")), InStrRev(Server.Mappath(Request.ServerVariables( "PATH_INFO ")), "\ ")) & filename
set f=fso.OpenTextFile(filename)
content=f.ReadAll
f.close
set f=nothing
set fso=nothing
set re=new RegExp
re.pattern= "^\s*= "
ASPEnd = 1
ASPStart= inStr(ASPEnd,content, " <% ")+2
do while ASPStart > ASPEnd+1
Response.write Mid(content,ASPEnd,ASPStart-ASPEnd-2)
ASPEnd=inStr(ASPStart,content, "%\> ")+2
Execute(re.replace(Mid(content,ASPStart,ASPEnd-ASPStart-2), "Response.Write "))
ASPStart=inStr(ASPEnd,content, " <% ")+2
loop
Response.write Mid(content,ASPEnd)
set re=nothing
End Function
这个include函数,在include 像这样的代码
<table>
<%for i = 1 to 5%>
<tr> <td> <%=i%> </td> </tr>
<%next%>
</table>
的文件会出现问题,请问有没有办法解决的?
------解决方案-------------------- <%
for i = 1 to 5
Response.Write " <tr> <td> " & i & " </td> </tr> "
next
%>