200811122
<%
Dim channelList,ClassStr
Set channelList = DB("Select [NAME] From [{pre}channel] Where [FatherID] in (3,4,5,6,7,8) GROUP BY [NAME] Order By [NAME] desc ", 1) ' 获取内容
if not channelList.eof then
do while not channelList.eof
if channelList("name")=newsYear then
ClassStr="active"
else
ClassStr=""
end if
%>
- &Cid=<%=Cid%>"><%=channelList("NAME")%>年新闻
<%
channelList.movenext
loop
end if
%>
<%
Function Ceil(num)
If num = Int(num) Then
Ceil = num
Else
Ceil = Int(num) + 1
End If
End Function
'新闻列表分页
DIM News, newsPage, newsPageList, offset, totalRecords, totalPages,rsCount
newsPageList = 6 ' 每页显示6条
' 获取当前页码
newsPage = Trim(Request.QueryString("page"))
If Len(newsPage) = 0 Or IsNull(newsPage) Or Not IsNumeric(newsPage) Then
newsPage = 1
Else
newsPage = CLng(newsPage)
If newsPage < 1 Then newsPage = 1
End If
offset = (newsPage - 1) * newsPageList
' 获取总记录数
Set rsCount = DB("SELECT COUNT(*) AS Total FROM [{pre}content] WHERE [CID] IN ("&Cids&")", 1)
totalRecords = rsCount("Total")
rsCount.Close
Set rsCount = Nothing
totalRecords = CLng(totalRecords) ' 转换为长整型
' 计算总页数
totalPages = Ceil(totalRecords / newsPageList)
' 如果页码超出总页数,修正
If newsPage > totalPages And totalPages > 0 Then
newsPage = totalPages
offset = (newsPage - 1) * newsPageList
End If
if newsPage=1 then
Set News= DB("select top "&newsPageList&" [ID],[CID],[Title],[Description],[IndexPic],[CreateTime] ,[viewPath] from [{pre}content] where [Cid] in ("&Cids&") order by [CreateTime] ",1)
else
Set News= DB("select top "&newsPageList&" [ID],[CID],[Title],[Description],[IndexPic],[CreateTime] ,[viewPath] from [{pre}content] where [Cid] in ("&Cids&") and [ID] not in( SELECT TOP "&offset&" [ID] FROM [{pre}content] WHERE [Cid] in ("&Cids&") order by [CreateTime] Desc ) order by [CreateTime] Desc ",1)
end if
Do while not News.eof
%>
<%
News.moveNext
Loop
%>