|
|
<%
'/////////////////////////////////////////////////////////////////////////////////////////
'作 用:新聞標題列表
'注 意:
' 1、參數:標題長度TitleLen, 頁記錄Num, 頁列Cols, 日期格式DateSkins;
' 2、TitleLen,一個漢字為2字節,一個英文為1字節;
' 3、日期格式:格式1 2005年4月17日 格式2 2005-4-17 格式5 2005-04-17
' 4、Num必須是Cols的公倍數
' 5、模糊查詢時查詢文章標題和文章內容
'/////////////////////////////////////////////////////////////////////////////////////////
Dim strUrl, TitleLen, Num, Cols, DateSkins
strUrl = "newsinfo.asp"
TitleLen = 54
Num = 15
Cols = 1
DateSkins = 2
SearchKeyword = Trim(Request("strKeyword"))
SearchSelect = Trim(Request("strSelect"))
%>
<%
SqlNewsList = " select ArtID, ArtTitle, ArtHits, ArtUpdateTime, ArtType from ArticleList00 "
SqlNewsList = SqlNewsList + " where ArtID >= 1 "
typeid = Trim(Request("typeid"))
If IsNumeric(typeid) = True And Trim(typeid) <> "" Then
SqlNewsList = SqlNewsList + " and ArtType = '"&typeid&"' "
End If
if SearchKeyword <> "" then
SearchKeyword = Replace( SearchKeyword, "'", "" )
Select Case SearchSelect
Case "0"
SqlNewsList = SqlNewsList + " and ArtTitle like '%"&SearchKeyword&"%' "
Case "1"
SqlNewsList = SqlNewsList + " and ArtContent like '%"&SearchKeyword&"%' "
Case Else
SqlNewsList = SqlNewsList + " and ArtTitle & ArtContent like '%"&SearchKeyword&"%' "
End Select
End If
SqlNewsList = SqlNewsList + " order by ArtRank "
set RsNewsList = server.CreateObject("adodb.recordset")
RsNewsList.open SqlNewsList, objConn, 1, 1
if RsNewsList.eof or RsNewsList.bof then
Response.Write("
No
")
else
RsNewsList.pagesize = Num
page = request("page")
If IsNumeric(page) = False Then
page = 1
Else
page = cint(page)
End If
if page < 1 then page = 1
if page > RsNewsList.pagecount then page = RsNewsList.pagecount
RsNewsList.absolutepage = page
j = RsNewsList.pagesize * ( page - 1) + i
%>
<%
for RsNewsList_i = 1 to RsNewsList.pagesize / Cols
%>
<%
for RsNewsList_j = 1 to Cols
%>
<%
if not RsNewsList.eof then
%>
<%
RsNewsList.movenext
end if
%> |
<%
next
%>
<%
if RsNewsList.eof then exit for
next
%>
|
|
|
<%
end if
RsNewsList.close
set RsNewsList = nothing
%> |
|