<%
Dim showRS, showSQL
Dim initPage, initRecord, initPageCount, initRecordCount
Dim initStart ' The record that we are starting on.
Dim initFinish ' The record that we are finishing on
If Request.QueryString("cat_id") = "" then
showSQL = "SELECT article_id, article_title,article_date,article_content, user_name, cat_name FROM articles AS a, users AS u, categories AS c WHERE a.user_id=u.user_id AND a.cat_id=c.cat_id ORDER BY article_date DESC"
Else
showSQL = "SELECT article_id, article_title,article_date,article_content, user_name, cat_name FROM articles AS a, users AS u, categories AS c WHERE a.user_id=u.user_id AND a.cat_id=c.cat_id AND c.cat_id=" & Request.QueryString("cat_id") &" ORDER BY article_date DESC"
End If
Set showRS = Server.CreateObject("ADODB.Recordset")
showRS.open showSQL, conn, 1, 1
If showRS.EOF or showRS.BOF then
Response.Write("Have no article yet.")
initPage = 1
initPageCount = 1
Else
If Request.QueryString("page") = "" Then
initPage = 1
Else
initPage = cInt(Request.QueryString("page"))
End If
showRS.PageSize = blogShows
showRS.CacheSize = showRS.PageSize
initPageCount = showRS.pageCount
initRecordCount = showRS.RecordCount
If cInt(initPage) > cInt(initPageCount) Then initPage = initPageCount End If
If cInt(initPage) <= 0 Then initPage = 1 End If
If initPageCount > 0 Then
showRS.AbsolutePage = initPage
initStart = showRS.AbsolutePosition
If cInt(initPage) = cInt(initPageCount) Then
initFinish = initRecordCount
Else
initFinish = initStart + (showRS.PageSize - 1)
End If
End if
Do until initRecord = showRS.PageSize or showRS.EOF
%>
<%
showRS.MoveNext
initRecord = initRecord + 1
Loop
End If
showRS.close
Set showRS = nothing
%>
<%
Dim currentURL
currentURL = blogURL + "/?"
If Request.QueryString("cat_id") <> "" Then
currentURL = currentURL + "act_id=" + Request.QueryString("cat_id") + "&page="
Else
currentURL = currentURL + "page="
End If
%>
<%=showRS("user_name")%> | <%=convertDatetime(showRS("article_date"))%>| <%=showRS("cat_name")%>
<%
Dim more, content
content = showRS("article_content")
more = ""
Response.Write(Split(content, more)(0))
%>
">Read More