发布网友
共1个回答
热心网友
给你一个生成静态页面的代码自己去研究一下哦
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>生成商业资讯分类</title>
</head>
<body>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #E4EDF9;
}
body,td,th {
font-size: 12px;
}
-->
</style>
<!--#include file="../../../conn/conn.asp"-->
<!--#include file="../../../inc/safe.asp"-->
<!--#include file="../../../inc/classcount.asp"-->
<%
'读取模板
set rs=server.createobject("adodb.recordset")
rs.open ("select info_list from As_shin_Temp"),conn,1,1
pencat=rs("info_list")
rs.close
'读取要生成的条数
if request("page")<>"" then
if cint(request("page"))<1 then
currentPage=1
else
currentPage=cint(request("page"))
end if
else
currentPage=1
end if
if request("page2")<>"" then
if cint(request("page2"))<1 then
currentPage2=1
else
currentPage2=cint(request("page2"))
end if
else
currentPage2=1
end if
'************** 读取一级分类 ***************
MaxPerPage=1
if request("all")="all" then
set rs=server.createobject("adodb.recordset")
rs.open ("select * from newstype order by typeID desc"),conn,1,1
end if
if not rs.eof then
rs.pagesize=MaxPerPage
mpage=rs.pagecount '得到总页数
rs.move (currentPage-1)*MaxPerPage
if mpage>=currentPage then
ttid=rs("typeID")
ttname=rs("type")
end if
end if
rs.close
response.write "<b>已生成/要生成的二级分类:<font color=#FF0000>"¤tPage-1&"</font>/<font color=#FF0000><b>"&mpage&"</b></font>个"
if mpage<currentPage then
response.write ",完成时间"&Now()&"</b> "
else
'************** 生成HTML页 开始 ***************
msg_per_page=20
if request("all")="all" then
set rs=server.createobject("adodb.recordset")
rs.open ("select * from news where typeid="&ttid&" order by newsID desc"),conn,1,1
end if
if not rs.eof then
totalrec=RS.RecordCount'总记录条数
rs.pagesize=msg_per_page '每页数
mpage2=rs.pagecount '得到总页数
rowcount=msg_per_page
rs.move (currentPage2-1)*MaxPerPage
if mpage2>=currentPage2 then
tttid=currentPage2
end if
end if
%>
<!--#include file="../../../inc/headpage_html.asp"-->
<%
if rs.eof then
L_BODY=L_BODY&"<br><br><div align='center' class='s'>此类商业资讯信息</div><br>"&vbCrlf
else
L_BODY=L_BODY&"<table width=""100%"" border=0 cellpadding=4 cellspacing=0 bordercolor=""#111111"" style=""border-collapse: collapse"">"&VbCrLf
do while not rs.eof and rowcount > 0
L_BODY=L_BODY&"<tr "
if icolor=0 then
L_BODY=L_BODY&"bgColor=#f9f9f9"
else
L_BODY=L_BODY&"bgColor=#ffffff"
end if
L_BODY=L_BODY&">"&VbCrLf
if len(rs("title"))>30 then
L_BODY=L_BODY&"<td width=""84%"" class=s><IMG src=""/info/images/club_index_15.gif"" width=12 height=14 align=""absmiddle""> <a href=""/info/detail/"&rs("typeid")&"-"&rs("newsid")&".html"" target=_blank>"&left(rs("title"),28)&"...</a></td>"&VbCrLf
else
L_BODY=L_BODY&"<td width=""84%"" class=s><IMG src=""/info/images/club_index_15.gif"" width=12 height=14 align=""absmiddle""> <a href=""/info/detail/"&rs("typeid")&"-"&rs("newsid")&".html"" target=_blank>"&rs("title")&"</a></td>"&VbCrLf
end if
L_BODY=L_BODY&"<td width=""16%"" align=right> <p align=""left"" class=s>["&FormatDate(rs("dateandtime"),2)&"] </td>"&VbCrLf
L_BODY=L_BODY&"</tr>"&VbCrLf
icolor=icolor+1
if icolor>1 then icolor=0
rowcount=rowcount-1
rs.movenext
loop
end if
L_BODY=L_BODY&"</table>"
L_BODY=L_BODY&"<br>"&vbCrlf
L_BODY=L_BODY&"<TABLE width=100% border=0 align=center cellPadding=1 cellSpacing=0 style='BORDER-TOP: #9C9A9C 1px solid;BORDER-Bottom: #9C9A9C 1px solid'>"&vbCrlf
L_BODY=L_BODY&"<TBODY>"&vbCrlf
L_BODY=L_BODY&"<TR>"&vbCrlf
L_BODY=L_BODY&"<TD>"&vbCrlf
L_BODY=L_BODY&"<TABLE cellSpacing=0 cellPadding=4 width=100% border=0>"&vbCrlf
L_BODY=L_BODY&"<TBODY>"&vbCrlf
L_BODY=L_BODY&"<TR>"&vbCrlf
L_BODY=L_BODY&"<TD class=s noWrap align=middle><b>"&vbCrlf
'************** 分页开始 ***************
if not (rs.eof and rs.bof) then
gopage=currentpage2
totalpage=mpage2
blockPage=Int((gopage-1)/5)*5+1
If LCase(Request.ServerVariables("HTTPS")) = "off" Then
strTemp = "http://"
Else
strTemp = "https://"
End If
strTemp = strTemp & CheckStr(Request.ServerVariables("SERVER_NAME"))
If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & CheckStr(Request.ServerVariables("SERVER_PORT"))
strTemp = strTemp & CheckStr(Request.ServerVariables("URL"))
lenstrTemp=len(strTemp)+1
if instr(left(linkfile,lenstrTemp),"?")>0 then
if blockPage = 1 Then
L_BODY=L_BODY&"<span disabled>【←前5页</span> "
Else
L_BODY=L_BODY&"<span disabled>【</span><a href="&ttid&"-p"&blockPage-5&".html>←前5页</a> "
End If
i=1
Do Until i > 5 or blockPage > mpage2
If blockPage=int(gopage) Then
L_BODY=L_BODY&"<font color=#FF0000>[<b>"&blockPage&"</b>]</font>"
Else
L_BODY=L_BODY&" <a href="&ttid&"-p"&blockPage&".html>["&blockPage&"]</a> "
End If
blockPage=blockPage+1
i = i + 1
Loop
if blockPage > totalpage Then
L_BODY=L_BODY&" <span disabled>后5页→】"
Else
L_BODY=L_BODY&" <a href="&ttid&"-p"&blockPage&".html>后5页→</a><span disabled>】"
End If
L_BODY=L_BODY&" 直接到第 "
L_BODY=L_BODY&"<select onchange=if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}>"
for i=1 to totalpage
L_BODY=L_BODY&"<option value="&ttid&"-p" & i & ".html"
if i=gopage then L_BODY=L_BODY&"selected"
L_BODY=L_BODY&">"&i&"</option>"
next
L_BODY=L_BODY&"</select>"
L_BODY=L_BODY&" 页<Br><Br>"
else
if blockPage = 1 Then
L_BODY=L_BODY&"<span disabled>【←前5页</span> "
Else
L_BODY=L_BODY&"<span disabled>【</span><a href="&ttid&"-p"&blockPage-5&".html>←前5页</a> "
End If
i=1
Do Until i > 5 or blockPage > mpage2
If blockPage=int(gopage) Then
L_BODY=L_BODY&"<font color=#FF0000>[<b>"&blockPage&"</b>]</font>"
Else
L_BODY=L_BODY&" <a href="&ttid&"-p"&blockPage&".html>["&blockPage&"]</a> "
End If
blockPage=blockPage+1
i = i + 1
Loop
if blockPage > totalpage Then
L_BODY=L_BODY&" <span disabled>后5页→】"
Else
L_BODY=L_BODY&" <a href="&ttid&"-p"&blockPage&".html>后5页→</a><span disabled>】"
End If
L_BODY=L_BODY&" 直接到第 "
L_BODY=L_BODY&"<select onchange=if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}>"
for i=1 to totalpage
L_BODY=L_BODY&"<option value="&ttid&"-p" & i & ".html"
if i=gopage then L_BODY=L_BODY&"selected"
L_BODY=L_BODY&">"&i&"</option>"
next
L_BODY=L_BODY&"</select>"
L_BODY=L_BODY&" 页<Br><Br>"
End If
Startinfo=((gopage-1)*msg_per_page)+1
Endinfo=gopage*msg_per_page
if Endinfo>totalrec then Endinfo=totalrec
L_BODY=L_BODY&" 共 "&totalrec&" 条信息 当前显示第 "&Startinfo&" - "&Endinfo&" 条 每页 "&msg_per_page&" 条信息 共 "&mpage2&" 页"
end if
L_BODY=L_BODY&"</b></TD>"&vbCrlf
L_BODY=L_BODY&"</TR>"&vbCrlf
L_BODY=L_BODY&"</TBODY>"&vbCrlf
L_BODY=L_BODY&"</TABLE></TD>"&vbCrlf
L_BODY=L_BODY&"</TR>"&vbCrlf
L_BODY=L_BODY&"</TBODY>"&vbCrlf
L_BODY=L_BODY&"</TABLE>"&vbCrlf
sql="select top 25 * from news where typeid="&ttid&" order by NewsID Desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof then
L_NEW=L_NEW&"<font color='#FFFFFF' class=white>此类暂无新增资讯</font>"
else
do while not rs.eof
L_NEW=L_NEW&"<a href='/info/detail/"&rs("typeid")&"-"&rs("newsid")&".html' target='_blank' class=white><font color='#FFFFFF'>"&rs("title")&"</font></a> "
rs.movenext
loop
end if
sql="select * from news where typeid="&ttid&" and homehot=1 and picture<>'nopicture.gif' order by NewsID desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof then
L_PICPT=L_PICPT&" <br><br><font class=""s"">暂无图片资讯</font>"
else
L_PICPT=L_PICPT&"<DIV align=center><a href='/info/detail/"&rs("typeid")&"-"&rs("newsid")&".html' target='_blank' class='s'><img src='/UploadFile/"&rs("picture")&"' width='170' height='142' hspace='5' vspace'5' class='porctborder'><br>"
L_PICPT=L_PICPT&"<br>"&left(rs("title"),13)&"</a></div>"
end if
sql="select * from news where typeid="&ttid&" and homehot<>1 and picture<>'nopicture.gif' order by NewsID desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof then
L_PICTJ=L_PICTJ&" <br><br><font class=""s"">此类暂无推荐图片资讯</font>"
else
L_PICTJ=L_PICTJ&"<DIV align=center><a href='/info/detail/"&rs("typeid")&"-"&rs("newsid")&".html' target='_blank' class='s'><img src='/UploadFile/"&rs("picture")&"' width='170' height='142' hspace='5' vspace'5' class='porctborder'><br>"
L_PICTJ=L_PICTJ&"<br>"&left(rs("title"),13)&"</a></div>"
end if
sql="select * from news where typeid="&ttid&" and tjnews=1 order by NewsID Desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof then
L_HOT=L_HOT&" 暂无此栏目推荐资讯"
else
L_HOT=L_HOT&"<a href='/info/detail/"&rs("typeid")&"-"&rs("newsid")&".html' target='_blank' class=white><FONT class=S1 color=#3D362B>"&rs("title")&"</font></a>"
end if
'************** 读取内容结束 ***************
L_WORLDECNEME=L_WORLDNEME&""&webname&"" '网站名称
L_WORLDECURL=L_WORLDECURL&""&weburl&"" '网址
L_SYSTEMTEL=L_SYSTEMTEL&""&Systemtel&"" '服务热线
L_TITLE=L_TITLE&""&ttname&"资讯" '网页标题头
L_DATE=L_DATE&""&zixun_datetime_erji&"" '今日新增数
L_TYPID=L_TYPID&""&ttid&""
pencat=replace(pencat,"L_WORLDECNEME",L_WORLDECNEME)
pencat=replace(pencat,"L_WORLDECURL",L_WORLDECURL)
pencat=replace(pencat,"L_TITLE",L_TITLE)
pencat=replace(pencat,"L_BODY",L_BODY)
pencat=replace(pencat,"L_SYSTEMTEL",L_SYSTEMTEL)
pencat=replace(pencat,"L_DATE",L_DATE)
pencat=replace(pencat,"L_TYPID",L_TYPID)
pencat=replace(pencat,"L_NEW",L_NEW)
pencat=replace(pencat,"L_PICPT",L_PICPT)
pencat=replace(pencat,"L_PICTJ",L_PICTJ)
pencat=replace(pencat,"L_HOT",L_HOT)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if mpage2>1 then
if cint(request("page2"))<1 then
Set fout = fso.CreateTextFile(server.mappath("/info/community/"&ttid&".html"))
fout.Write pencat
fout.close
end if
Set fout = fso.CreateTextFile(server.mappath("/info/community/"&ttid&"-p"&tttid&".html"))
fout.Write pencat
fout.close
else
Set sort_save = fso.CreateTextFile(server.mappath("/info/community/"&ttid&".html"))
sort_save.Write pencat
sort_save.close
end if
set fso = nothing
if currentPage2<mpage2 then
response.write "<br>已生成*页/此类共*页:<font color=#FF0000>"¤tPage2&"</font>/共<font color=#FF0000><b>"&mpage2&"</b></font>页,"
response.write "<meta http-equiv=Refresh content='0; URL=makelist.asp?all="&request("all")&"&page="¤tPage&"&page2="&cint(currentPage2+1)&"'>"
else
response.write "<meta http-equiv=Refresh content='0; URL=makelist.asp?all="&request("all")&"&page="¤tPage+1&"'>"
end if
end if
'************** 生成HTML页 结束 ***************
'##############################################
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
QQ252112267