%
Dim action
action=ReqString("action")
Select Case action
Case "read"
Call read()
Case Else
Call main()
End Select
Sub main()
Dim CatId,objRs,Cat_Name,title
CatId=ChkNumeric(ReqString("Id"))
Set objRs=Execute("SELECT * FROM Category WHERE Id="&CatId)
If Not objRs.Eof Then
Cat_Name=objRs("CategoryName")
End If
objRs.Close
title=Cat_Name&" - 名人俱乐部"
%>
<%
Dim CountPage,CountNum,i,CurrentPage,intYear, intMonth ,intDay
Dim Art_Title
CurrentPage=ChkNumeric(ReqString("page"))
If CurrentPage=0 Then CurrentPage=1
If CatId=5 Then
Set objRs = pageRecordSet("SELECT title,id,ptime FROM Article WHERE CategoryId="&CatId&" Order by OrderId",1,1,30,CurrentPage)
Else
Set objRs = pageRecordSet("SELECT title,id,ptime FROM Article WHERE CategoryId="&CatId&" Order by OrderId",1,1,15,CurrentPage)
End If
CountPage = objRs.PageCount
Countnum = objRs.RecordCount
If Countpage=0 Then Countpage=1
i=1
If objRs.Eof Then
%>
暂无记录!
<%
End If
Do While Not objRs.Eof And i<=objRs.PageSize
Art_Title=objRs("title")
If Len(Art_Title)>40 Then
Art_Title=Left(Art_Title,40)&"..."
End If
intYear = Year(objRs("Ptime"))
intMonth = Month(objRs("Ptime")):If intMonth<10 Then intMonth="0"&intMonth
intDay = Day(objRs("Ptime")):If intDay<10 Then intDay="0"&intDay
%>
共 <%= countnum %> 条纪录 当前第<%= CurrentPage %>/<%= CountPage %>页
<% If CurrentPage<>1 Then %>
首页
<% Else %>
首页
<% End If %>
|
<% If CurrentPage>1 Then %>
上一页
<% Else %>
上一页
<% End If %>
|
<% If CurrentPage下一页
<% Else %>
下一页
<% End If %>
|
<% If CurrentPage末页
<% Else %>
末页
<% End If %>
转到第
页
<%
End Sub
Sub read()
Dim art_id,art_title,art_content,art_ptime,cat_id,cat_name,title
Dim objRs,catRs
art_id=ChkNumeric(ReqString("id"))
Set objRs=Execute("SELECT * FROM Article WHERE id="&art_id)
If Not objRs.Eof Then
art_title=objRs("title")
art_content=objRs("content")
art_ptime=objRs("ptime")
cat_id=objRs("categoryid")
Set catRs=Execute("SELECT * FROM Category WHERE id="&cat_id)
If Not catRs.Eof Then
cat_name=catRs("categoryname")
End If
catRs.Close
Else
ErrMsg("不存在的记录!")
End If
objRs.Close
Dim disp_content,page,countpage,pagestr,i
page=ChkNumeric(ReqString("page"))
If page=0 Then page=1
If Not isNull(art_content) Then
art_content=Split(art_content,"{$pagebreak}")
countpage=Ubound(art_content)
If page>countpage+1 Then page=countpage+1
If countpage>=0 Then disp_Content=art_content(page-1)
End If
If countpage>0 Then
pagestr="共"&(countpage+1)&"页 "
For i=1 to (countpage+1)
If page=i Then
pagestr=pagestr&"第"&i&"页 "
Else
pagestr=pagestr&"第"&i&"页 "
End If
Next
End If
title=cat_name&" - 名人俱乐部"
%>