ASP程序生成静态网页路径出错
程序1生成的网页路径是对的,格式为www.程序2生成的网页路径错误,格式为www.
新人就15分了,全部拿出来求答案,提前感谢先。
程序1
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="co.asp"-->
<%
yusername=Request.Cookies("adminname888")
'response.Write yname
'response.end()
if yusername="" then
response.redirect("index.asp")
end if
%>
<%'容错处理
On Error Resume Next
%>
<%
a=request.QueryString("id")
set rs=server.CreateObject("ADODB.recordset")
sql="SELECT * FROM xw where id="&a&" Order by uid desc "
rs.open sql,connstr,3,3
cc=rs.recordcount
%>
<%
aa3=rs("bt")
aa4=rs("txt")
aa5=rs("data")
wjm=rs("url")
%>
<%
set rsxw=server.CreateObject("ADODB.recordset")
sqlxw="SELECT * FROM xw Order by dj desc"
rsxw.open sqlxw,connstr,3,3
xwhot=""
xwhot=xwhot&"<table width=210 border=0 cellspacing=0 cellpadding=0>"
dim n
n=1
do while not rsxw.eof and n<=12
xwhot=xwhot&"<tr valign=top>"
xwhot=xwhot&"<td width=210 height=28> ·<a href="&rsxw("id")&".html class=style3>"&left(rsxw("bt"),14)&"</a></td>"
xwhot=xwhot&"</tr>"
rsxw.movenext
n=n+1
loop
xwhot=xwhot&"</table>"
%>
<%
set rsxw1=server.CreateObject("ADODB.recordset")
sqlxw1="SELECT * FROM xw Order by id desc"
rsxw1.open sqlxw1,connstr,3,3
xwhot1=""
xwhot1=xwhot1&"<table width=210 border=0 cellspacing=0 cellpadding=0>"
dim n1
n1=1
do while not rsxw1.eof and n1<=12
xwhot1=xwhot1&"<tr valign=top>"
xwhot1=xwhot1&"<td width=210 height=28> ·<a href="&rsxw1("id")&".html class=style3>"&left(rsxw1("bt"),14)&"</a></td>"
xwhot1=xwhot1&"</tr>"
rsxw1.movenext
n1=n1+1
loop
xwhot1=xwhot1&"</table>"
%>
<%
'打开模板代码,并将其中特殊代码转变为接受值
set rs1=server.CreateObject("ADODB.recordset")
sql1="SELECT * FROM mb where id=1"
rs1.open sql1,connstr,1,1
'sql1="select m_id,m_html from c_moban where m_id=2"
'set rs1=Server.CreateObject("adodb.recordset")
'rs1.open sql1,conn,1,1
mb_code=rs1("mb")
mb_code=replace(mb_code,"$$bt$$",aa3)
mb_code=replace(mb_code,"$$txt$$",aa4)
mb_code=replace(mb_code,"$$data$$",aa5)
mb_code=replace(mb_code,"$$id$$",a)
mb_code=replace(mb_code,"$$xwhot$$",xwhot)
mb_code=replace(mb_code,"$$xwhot1$$",xwhot1)
'生成HTML页面
Dim fso,f
Dim strTitle,strContent,strOut
'创建文件系统对象
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set f=fso.CreateTextFile(Server.MapPath("../"&wjm),true)
'写入网页内容
f.WriteLine mb_code
f.close
aa="正在生成第"&n&"个文件——"&rs("id")&"—"&rs("url")&"<br>"
response.Write aa
'response.end()
%>
<html>
<head>
<title>k</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/basic.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
.style2 {color: #000000}
.style3 {
font-size: 18px;
font-weight: bold;
}
.style4 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style></head>
<body>
<div align="center">
<br>
<br>
<br>
<br>
</div>
</body>
</html>
程序2
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="co.asp"-->
<%
yusername=Request.Cookies("adminname888")
'response.Write yname
'response.end()
if yusername="" then
response.redirect("index.asp")
end if
%>
<%
sql="select * from xw Order by uid desc"
set rs=server.createObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
<%
rs.pagesize=25
totalpage=rs.pagecount
rs.close
set rs=nothing
for j=1 to totalpage
sql="select * from xw Order by uid desc"
set rs=server.createObject("ADODB.Recordset")
rs.open sql,conn,1,1
whichpage=j
rs.pagesize=25
totalpage=rs.pagecount
rs.absolutepage=whichpage
howmanyrecs=0
tatalrecord=rs.recordcount
nowpage=request("page")
tatalpages=rs.pagecount
%>
<%
set rsxw=server.CreateObject("ADODB.recordset")
sqlxw="SELECT * FROM xw Order by dj desc"
rsxw.open sqlxw,connstr,3,3
%>
<%
set rsxw1=server.CreateObject("ADODB.recordset")
sqlxw1="SELECT * FROM xw Order by id desc"
rsxw1.open sqlxw1,connstr,3,3
%>
<%
dj=""
dj=dj&"<table width=210 border=0 cellspacing=0 cellpadding=0>"
dim n
n=1
do while not rsxw.eof and n<=12
dj=dj&"<tr valign=middle>"
dj=dj&"<td width=27 height=26><img src=sz/"&n&".gif width=22 height=14> </td>"
dj=dj&"<td width=183><a href="&rsxw("id")&".html class=style7>"&left(rsxw("bt"),15)&"</a></td>"
dj=dj&"</tr>"
rsxw.movenext
n=n+1
loop
dj=dj&"</table>"
%>
<%
dj1=""
dj1=dj1&"<table width=210 border=0 cellspacing=0 cellpadding=0>"
dim n1
n1=1
do while not rsxw1.eof and n1<=12
dj1=dj1&"<tr valign=middle>"
dj1=dj1&"<td width=27 height=26><img src=sz/"&n1&".gif width=22 height=14> </td>"
dj1=dj1&"<td width=183><a href="&rsxw1("id")&".html class=style7>"&left(rsxw1("bt"),15)&"</a></td>"
dj1=dj1&"</tr>"
rsxw1.movenext
n1=n1+1
loop
dj1=dj1&"</table>"
%>
<%
str0=""
str0=str0&"<table width=713 height=22 border=0 cellpadding=0 cellspacing=0>"
dim n41
n41=1
do while not rs.eof and n41<=rs.pagesize
str0=str0&"<tr>"
str0=str0&"<td width=18 height=28 align=center valign=middle>·</td>"
str0=str0&"<td width=559 align=left valign=middle class=style7><a href="&rs("url")&" class=style7>"&rs("bt")&"</a></td>"
str0=str0&"<td width=136 align=left valign=middle>"&rs("data")&"</td>"
str0=str0&"</tr>"
rs.movenext
n41=n41+1
loop
str0=str0&"</table>"
%>
<%
'分页部分
ref=""
ref=ref&"<br>"
ref=ref&"<table width=690 border=0 align=right cellpadding=0 cellspacing=0> "
ref=ref&"<tr align=right>"
ref=ref&"<td> "
ref=ref&"第"&j&"页 共"&totalpage&"页 "&tatalrecord&"记录"
ref=ref&" <a href=xw1.html"&" class=txt7>首页</a> "
if whichpage=1 then
ref=ref&" 上一页 "
else
ref=ref&" <a href=xw"&j-1&".html"&" class=txt7>上一页</a> "
end if
if (whichpage>totalpage or whichpage=totalpage) then
ref=ref&" 下一页 "
else
ref=ref&" <a href=xw"&j+1&".html"&" class=txt7>下一页</a> "
end if
ref=ref&" <a href=xw"&totalpage&".html"&" class=txt7>末页</a> "
ref=ref&"</td>"
ref=ref&"<td width=50 align=center>"
ref=ref&"<select name=leckmenu1leck onChange=leckMM_jumpMenu('parent',this,0)leck>"
for k=1 to tatalpages
if k<>nowpaga then
ref=ref&"<option value=leckxw"&k&".htmlleck"
au=chr(34)
ref=replace(ref,"leck",au)
if k=j then
ref=ref&"selected"
end if
ref=ref&">"&k&"</option>"
else
k
end if
next
ref=ref&"</select>"
ref=ref&"</td>"
ref=ref&"<td align=left width=30>页"
ref=ref&"</td>"
ref=ref&"</tr>"
ref=ref&"</table> "
aa2=str0&ref
'打开模板代码,并将其中特殊代码转变为接受值
set rs1=server.CreateObject("ADODB.recordset")
sql1="SELECT * FROM mb where id=14"
rs1.open sql1,connstr,1,1
'sql1="select m_id,m_html from c_moban where m_id=2"
'set rs1=Server.CreateObject("adodb.recordset")
'rs1.open sql1,conn,1,1
mb_code=rs1("mb")
mb_code=replace(mb_code,"$$txt$$",aa2)
mb_code=replace(mb_code,"$$dj$$",dj)
mb_code=replace(mb_code,"$$dj1$$",dj1)
Dim fso,f
Dim strTitle,strContent,strOut
'创建文件系统对象
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set f=fso.CreateTextFile(Server.MapPath("../xw"&j&".html"),true)
'写入网页内容
f.WriteLine mb_code
f.close
response.write "正在生成第"&j&"个页面!<br>"
%>
<%
next
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
</body>
</html>