局部代码分离技术思路
temp.asp
<!--#include file="temp_Fn.asp"--> <table> <tr> <td>标题</td> <td>天数</td> </tr> <% tempstr="<tr>"&vbcrlf&_ vbtab&"<td>[temp:标题]</td>"&vbcrlf&_ vbtab&"<td>[temp:天数]</td>"&vbcrlf&_ vbtab&"</tr>"&vbcrlf call rplTemp(tempstr) %> </table>
temp_Fn.asp
<% sub rplTemp(tempStr) Set rs=Server.Createobject("adodb.recordset") sql="select * from [main]" rs.open sql,conn,1,1 do until rs.eof Str=tempStr Str=replace(Str,"[temp:标题]",rs("title")) Str=replace(Str,"[temp:天数]",rs("days")) allStr=allStr&Str rs.movenext Loop rs.close Set rs=Nothing Response.Write allStr end sub %>