jb51生成所有页面的效果+分页生成
2018-09-06 13:07
复制代码 代码如下:
<!--#includefile=conn.asp-->
<styletype=text/css>
body,td,th{
color:#000000;
font-size:14px;
background-color:#D6DFF7;
}
</style>
<%
dimrs
setrs=server.CreateObject(adodb.recordset)
ifrequest(type)=datethen
yearstr=request(selyear)
monstr=request(selmonth)
daystr=request(selday)
ifdaystr<>then
theymd=yearstr&-&monstr&-&daystr
sql=selectidfromnewswheredatetimelike&theymd&%orderbydatetimedesc
else
theymd=yearstr&-&monstr&-
sql=selectidfromnewswheredatetimelike&theymd&%orderbydatetimedesc
endif
elseifrequest(type)=newthen
topnew=request(newcount)
iftopnew<>then
topnew=cint(topnew)
sql=selecttop&topnew&idfromnewsorderbydatetimedesc
endif
elseifrequest(type)=noshthen
sql=selectidfromnewswhereshengcheng=0
elseifrequest(type)=allthen
sql=selectidfromnewsorderbyiddesc
endif
ifsql<>then
response.writesql
response.write<center><b><fontcolor=#FF0000>正在生成文章内容页的Html页,请等待......</font></b><spanid=showImport></span></center><IE:DownloadID=oDownloadSTYLE=behavior:url(#default#download)/>
ifrequest(p)<>then
p=cint(request(p))
else
p=1
endif
MaxPerPage=100
rs.opensql,conn,1,1
ifnotrs.eofthen
rs.pagesize=MaxPerPage得到每页数
mpage=rs.pagecount得到总页数
allshu=rs.recordcount得到总数
rs.move(p-1)*MaxPerPage
dowhilenotrs.eof
i=i+1
callMakeHtml()
ifi>=MaxPerPagethenexitdo
rs.movenext
loop
endif
rs.close
Sshu=MaxPerPage*p-MaxPerPage+1当前已经生成的数量
Tshu=Sshu+i-1已生成生成的
ifallshu<Sshuthen
setrs=nothing
conn.close
setconn=nothing
response.redirectmakehtmlall.asp?type=ok&&shu=&request(shu)&&D=&d&&p=&p+1
response.end
else
%>
<metahttp-equiv=refreshcontent=0;url=makehtmlall.asp?type=<%=request(type)%>&newcount=<%=request(newcount)%>&selyear=<%=request(selyear)%>&selmonth=<%=request(selmonth)%>&selday=<%=request(selday)%>&shu=<%=Tshu%>&D=<%=D%>&p=<%=p+1%>>
<divalign=center><br>正在生成:第(<%=Sshu%>/<%=Tshu%>)个共<%=allshu%>个</div>
<%
endif
SubMakeHtml()
%>
</script>
<%
endSub
-----------------------sql为空-------------------
else
setrstotal=conn.execute(selectcount(*)fromnews)
nowtotal=rstotal(0)
rstotal.close
setrstotal=nothing
setnosh=conn.execute(selectcount(*)fromnewswhereshengcheng=0)
nownosh=nosh(0)
nosh.close
setnosh=nothing
-------------------
ifrequest(type)=okthen
%><divalign=center>
<br><br>操作成功:共生成页面
<fontcolor=#FF0000><%=request(shu)%></font>个,完成时间<%=now()%>
</center>
<%
endif
-------------------------
%>
<tablewidth=511border=0align=centercellpadding=10cellspacing=1bgcolor=#FFFFFF>
<formaction=makehtmlall.asp?type=datemethod=post><tr>
<tdwidth=99height=25nowrapbgcolor=#D6DFF7>按日期生成:</td>
<tdwidth=369nowrapbgcolor=#D6DFF7><selectname=selyear>
<%
foryearstr=2001toyear(date)
ifyearstr=year(date)then
response.write<optionvalue=&yearstr&selected>&yearstr&</option>
else
response.write<optionvalue=&yearstr&>&yearstr&</option>
endif
next
%>
</select>-
<selectname=selmonth>
<%
formonstr=1to12
ifmonstr=month(date)then
response.write<optionvalue=&monstr&selected>&monstr&</option>
else
response.write<optionvalue=&monstr&>&monstr&</option>
endif
next
%>
</select>-
<selectname=selday>
<optionvalue=></option>
<%
fordaystr=1to31
ifdaystr=day(date)then
response.write<optionvalue=&daystr&selected>&daystr&</option>
else
response.write<optionvalue=&daystr&>&daystr&</option>
endif
next
%>
</select>
<inputtype=submitname=Submitvalue=生成></td>
</tr>
</form>
<formaction=makehtmlall.asp?type=newmethod=post>
<tr>
<tdheight=25nowrapbgcolor=#D6DFF7>按最新的生成:</td>
<tdnowrapbgcolor=#D6DFF7>生成最新的
<inputname=newcounttype=textid=newcountsize=10>
个文章
<inputtype=submitname=Submit2value=生成></td>
</tr>
</form>
<formaction=makehtmlall.asp?type=noshmethod=post>
<tr>
<tdheight=25nowrapbgcolor=#D6DFF7>没有生成过的:</td>
<tdnowrapbgcolor=#D6DFF7>当前需要生成文章[<fontcolor=red><%=nownosh%></font>]
<inputtype=submitname=Submit4value=生成></td>
</tr>
</form>
<formaction=makehtmlall.asp?type=allmethod=post>
<tr>
<tdheight=25nowrapbgcolor=#D6DFF7>生成全部:</td>
<tdnowrapbgcolor=#D6DFF7>共[<fontcolor=red><%=nowtotal%></font>]
<inputtype=submitname=Submit3value=生成></td>
</tr>
</form>
</table>
<%
endif
%>
文章标题:jb51生成所有页面的效果+分页生成
文章链接:http://soscw.com/index.php/essay/10928.html