'-----生成分类(排序)代码,应用于调用-----------------------------
Function Makebook(Classid,Str,cont)
Select Case Str
Case "0"
sString = "默认排列"
sHref
= ""
oRderby = "updatetime"
Case "1"
sString = "总点击榜"
sHref
= Book_Chits&"/"
oRderby = "Chits"
Case "2"
sString = "月点击榜"
sHref
= Book_Mhits&"/"
oRderby = "Mhits"
Case "3"
sString = "周点击榜"
sHref
= Book_Whits&"/"
oRderby = "Whits"
Case "4"
sString = "总推荐榜"
sHref
= Book_Crecs&"/"
oRderby = "Crecs"
Case "5"
sString = "月推荐榜"
sHref
= Book_Mrecs&"/"
oRderby = "Mrecs"
Case "6"
sString = "周推荐榜"
sHref
= Book_Wrecs&"/"
oRderby = "Wrecs"
Case "7"
sString = "总收藏榜"
sHref
= Book_Collects&"/"
oRderby = "Collects"
End Select
If Cont = "0" Then
Class_href = List_over
oHref
= "完成作品"
Else
Class_href = Class_more
oHref
= "全部作品"
End If
If Classid = "0" Then
cHref
= ""
Else
cHref
= readtype(Classid,"Classname","List_class")&"-"
End If
If Classid = "0" And Cont = "0" Then
Cardnumber = conn.execute("select count(*) as recount from [List_book] where Islock=0 and Iscont=0")("recount")
ElseIf Classid <> "0" And Cont = "0" Then
Cardnumber = conn.execute("select count(*) as recount from [List_book] where Islock=0 and Classid="&Classid&" and Iscont=0")("recount")
ElseIf Classid = "0" And Cont = "1" Then
Cardnumber = conn.execute("select count(*) as recount from [List_book] where Islock=0")("recount")
ElseIf Classid <> "0" And Cont = "1" Then
Cardnumber = conn.execute("select count(*) as recount from [List_book] where Islock=0 and Classid="&Classid&"")("recount")
End If
sPageSize = Pagesizes
If Cardnumber mod sPageSize > 0 Then
sPgnum = Cint(Fix(Cardnumber/sPageSize) + 1)
Else
sPgnum = Cint(Cardnumber/sPageSize)
End If
If sPgnum > 0 Then
If sPage="" Or sPage<1 Then sPage = 1
If sPage > sPgnum Then sPage = sPgnum
For sPage = 1 To sPgnum
sPagecount = sPageSize*(sPage-1)
Set rs=Server.CreateObject("ADODB.Recordset")
If Classid = "0" And Cont = "0" Then
sql="select top "&sPageSize&" id,classid,bookname,writer,updatetime,Iscont from [List_book] where Islock=0 and Iscont=0 and not id in (select top "&sPagecount&" id from [List_book] where Islock=0 and Iscont=0 order by "&oRderby&" desc) order by "&oRderby&" desc"
ElseIf Classid <> "0" And Cont = "0" Then
sql="select top "&sPageSize&" id,classid,bookname,writer,updatetime,Iscont from [List_book] where Islock=0 and Classid="&Classid&" and Iscont=0 and not id in (select top "&sPagecount&" id from [List_book] where Islock=0 and Classid="&Classid&" and Iscont=0 order by "&oRderby&" desc) order by "&oRderby&" desc"
ElseIf Classid = "0" And Cont = "1" Then
sql="select top "&sPageSize&" id,classid,bookname,writer,updatetime,Iscont from [List_book] where Islock=0 and not id in (select top "&sPagecount&" id from [List_book] where Islock=0 order by "&oRderby&" desc) order by "&oRderby&" desc"
ElseIf Classid <> "0" And Cont = "1" Then
sql="select top "&sPageSize&" id,classid,bookname,writer,updatetime,Iscont from [List_book] where Islock=0 and Classid="&Classid&" and not id in (select top "&sPagecount&" id from [List_book] where Islock=0 and Classid="&Classid&" order by "&oRderby&" desc) order by "&oRderby&" desc"
End If
rs.open sql,conn,1,1
Pager = Makepage(cardnumber,sPage,FrontPage,AllPage,sPgnum)
Content = ""
do while not rs.eof
id=rs("id")
classname=readtype(rs("Classid"),"classname","List_class")
bookname=rs("bookname")
writer=rs("writer")
updatetime=rs("updatetime")
Set rs1=Server.CreateObject("ADODB.Recordset")
sql="select id,viewname from [List_view] where bookid="&id&" and Islock=0 order by id desc"
rs1.open sql,conn,1,1
If not rs1.eof Then
viewid=rs1("id")
viewname=rs1("viewname")
End If
rs1.close:set rs1=nothing
Content = Content & "<ul>" & Chr(13)
If Str = "" Then
Content = Content & "<li class=""l1"">[<a href="""&Class_href&rs("Classid")&"/1/"">"&classname&"</a>]</li>" & Chr(13)
Else
Content = Content & "<li class=""l1"">[<a href="""&Class_href&sHref&rs("Classid")&"/1/"">"&classname&"</a>]</li>" & Chr(13)
End If
Content = Content & "<li class=""l2""><a href="""&view_read&rs("Classid")&"/"&id&"/"">"&bookname&"</a></li>" & Chr(13)
Content = Content & "<li class=""l3""><a href="""&view_html&rs("Classid")&"/"&id&"/"&viewid&"/"">"&viewname&"</a></li>" & Chr(13)
Content = Content & "<li class=""l4""> "&Right(Year(updatetime),2)&"-"&Month(updatetime)&"-"&Day(updatetime)&"</li>" & Chr(13)
Content = Content & "<li class=""l5"">"&writer&"</li>" & Chr(13)
Content = Content & "<li class=""l6"">完成</li>" & Chr(13)
Content = Content & "</ul>" & Chr(13)
rs.movenext
loop
Header = FSOFileRead("/Model/head.htm")
Bottom = FSOFileRead("/Model/Bottom.htm")
Template = FSOFileRead("/Model/class.htm")
Template = Replace(Template,"{$Header$}",Header)
If Classid = "0" and Cont = "0" Then
Template = Replace(Template,"{$classname$}","全本小说")
ElseIf Classid = "0" and Cont = "1" Then
Template = Replace(Template,"{$classname$}","全部书籍")
Else
Template = Replace(Template,"{$classname$}",classname)
End If
Template = Replace(Template,"{$bottom$}",Bottom)
Template = Replace(Template,"{$Content$}",Content)
Template = Replace(Template,"{$Inturn$}",Maketurn(Classid,Class_href))
Template = Replace(Template,"{$Page$}",Pager)
Template = Replace(Template,"{$New$}",Newadd("12"))
Template = Replace(Template,"{$Rec$}",Classhits(Classid,"12"))
Template = Replace(Template,"{$Hit$}",Makerank("Dhits","12"))
Template = Replace(Template,"{$site_title$}",site_title)
Template = Replace(Template,"{$site$}",site)
Call createhtml(Class_href&sHref&Classid&"/"&sPage&"/"&web_Html,Template)
Response.Write "生成分类【"&oHref&"-"&cHref&sString&"】第"&sPage&"页,地址:<a href="""&Class_href&sHref&Classid&"/"&sPage&"/"" target=""_blank"">"&Class_href&sHref&Classid&"/"&sPage&"/</a><br />"
rs.close:set rs=nothing
Next
Response.Flush()
Response.Clear()
End If
End Function