<% dim st st = Timer const pubCMS_documents_view = "(select DocumentID, Subject, Keywords, Vote, Documents.CategoryID, hits, Style, PublishDate, voteNum, Commend, TempletID, Author, fromID, FileUrl, Summary, CreateDateTime, UpdateDateTime, Documents.Audit, ParentDocumentID, Content, UserName, DocumentType, ParentID, CategoryLevel, CategoryName, OrderNum, OrderNum2, Directory, SubDirectoryRule, DirectoryUrl, CategoryHomeUrl, Description, HomePageTempletID, IsColumn, IsVirtual, Path, FileNameRule, DocumentTempletID, DefaultTextFormat, useDocumentTemplate, useTextFormat, Meta, Properties, DefaultContentTemplate from Documents inner join Category on Documents.CategoryID=Category.CategoryID where fileurl is not null and Documents.audit=1 union all select Documents.DocumentID, Subject, Keywords, Vote, Documents.CategoryID, hits, Style, PublishDate, voteNum, Commend, TempletID, Author, fromID, FileUrl, Summary, CreateDateTime, UpdateDateTime, Documents.Audit, ParentDocumentID, Content, UserName, DocumentType, ParentID, CategoryLevel, CategoryName, OrderNum, OrderNum2, Directory, SubDirectoryRule, DirectoryUrl, CategoryHomeUrl, Description, HomePageTempletID, IsColumn, IsVirtual, Path, FileNameRule, DocumentTempletID, DefaultTextFormat, useDocumentTemplate, useTextFormat, Meta, Properties, DefaultContentTemplate from ([column] inner join Documents on [column].documentid=documents.documentid) inner join Category on [column].CategoryID=Category.CategoryID where isColumn=1 and fileurl is not null and Documents.audit=1) documents_view " const pubCMS_documents_view2 = "(select DocumentID, Subject, Keywords, Vote, Documents.CategoryID, hits, Style, PublishDate, voteNum, Commend, TempletID, Author, fromID, FileUrl, Summary, CreateDateTime, UpdateDateTime, Documents.Audit, ParentDocumentID, Content, UserName, DocumentType, ParentID, CategoryLevel, CategoryName, OrderNum, OrderNum2, Directory, SubDirectoryRule, DirectoryUrl, CategoryHomeUrl, Description, HomePageTempletID, IsColumn, IsVirtual, Path, FileNameRule, DocumentTempletID, DefaultTextFormat, useDocumentTemplate, useTextFormat, Meta, Properties, DefaultContentTemplate from Documents inner join Category on Documents.CategoryID=Category.CategoryID where fileurl is not null and Documents.audit=1) documents_view " dim wtable wtable= pubCMS_documents_view & " where path like '/root/05_yjck/04_wzxw%' " dim con set con = CreateObject("ADODB.Connection") con.open Application("ConnectionString") dim td set td = new Dataset td.sql = "select subject, publishdate, fileurl, cast(content as nvarchar(500)) from " & wtable & " and year(publishdate)=year(getdate()) and month(publishdate)=month(getdate()) and day(publishdate)=day(getdate()) order by publishdate desc" td.execute(con) dim yt set yt = new Dataset yt.sql = "select subject, publishdate, fileurl, cast(content as nvarchar(500)) from " & wtable & " and year(publishdate)=year(getdate()) and month(publishdate)=month(getdate()) and day(publishdate)=day(getdate())-1 order by publishdate desc" yt.execute(con) dim bf set bf = new Dataset bf.sql = "select subject, publishdate, fileurl from " & wtable & " and year(publishdate)=year(getdate()) and datepart(wk, publishdate) = datepart(wk, getdate()) and day(publishdate) 0 or yt.recordcount > 0 or bf.recordcount > 0 or pw.recordcount > 0 then rs.FirstPageSize = 6 end if rs.AbsolutePage = Request("page") dim an an = " and (year(publishdate) <% If rs.AbsolutePage = 1 Then %>

日期:今天

<% If td.eof Then %>
暂无信息...
<% End If %> <% do until td.eof %>
<%= td(0) %>[<%= td(1) %>]
<% = getContent(td(3)) %>
<% td.movenext loop %>

日期:昨天

<% If yt.eof Then %>
暂无信息...
<% End If %> <% do until yt.eof %>
<%= yt(0) %>[<%= yt(1) %>]
<% = getContent(yt(3)) %>
<% yt.movenext loop %>

日期:前几天

    <% If bf.eof Then %>
  • 暂无信息...
  • <% End If %> <% do until bf.eof %>
  • <%= bf(0) %>[<%= bf(1) %>]
  • <% bf.movenext loop %>

日期:上周

    <% If pw.eof Then %>
  • 暂无信息...
  • <% End If %> <% do until pw.eof %>
  • <%= pw(0) %>[<%= pw(1) %>]
  • <% pw.movenext loop %>
<% End If %>

日期:更早

    <% do until rs.eof %>
  • <%= rs(0) %>[<%= rs(1) %>]
  • <% rs.movenext loop %>
<% call Pages(rs.pagesize, rs.recordcount, rs.pagecount, rs.absolutepage, Empty) %>
<% function getContent(ByVal xml) dim re set re = new Regexp re.pattern = "[\s\S]*?|$)[\s\S]*?" dim content content = re.replace(xml , "$1") re.global = true re.pattern = "<.*?>|<.*?$|&.*?;" content = re.replace(content, "") getContent = content end function sub Pages(ByVal PageSize, ByVal RecordCount, ByVal PageCount, ByVal page, ByVal fixedparam) PageSize = PageSize + 0 RecordCount = RecordCount + 0 PageCount = PageCount + 0 page = page + 0 dim PrevNum : PrevNum = 2 dim NextNum : NextNum = 3 dim np : np = 1 if np < Page - PrevNum then np = Page - PrevNum end if dim xp : xp = PageCount if PageCount > Page + NextNum then xp = Page + NextNum end if dim sb : set sb = new StringBuffer if Page > 1 then sb.append("<< ") sb.append("<PREV ") end if if np > 1 then sb.append("... ") ' sb.append("... ") end if for x = np to Page-1 sb.append("") sb.append(x) sb.append(" ") next sb.append("") sb.append(Page) sb.append("") for x = Page + 1 to xp sb.append("") sb.append(x) sb.append(" ") next if xp < PageCount then sb.append("... ") ' sb.append("... ") end if if Page < PageCount then sb.append("NEXT> ") sb.append(">> ") end if Response.Write(sb) end sub Class DataSetEx Public countSql, Sql Public maxRecords Public AbsolutePage, AbsolutePosition Public PageCount, PageSize, FirstPageSize Public RecordCount Public Count Private dbArr2, mFields Private Sub Class_Initialize set mFields = CreateObject("Scripting.Dictionary") End Sub Private Sub Class_Terminate set mFields = nothing End Sub Public Sub Execute(ByVal conn) AbsolutePosition = 1 if len(countSql)>0 then call Execute1(conn) else call Execute2(conn) end if if Count = 0 then AbsolutePosition = 0 End Sub Public Sub Execute1(ByRef conn) dim rs : set rs = CreateObject("Adodb.Recordset") rs.CursorLocation = 2 countSql = RegReplace(countSql, "order by.*", "") on error resume next rs.open countSql, conn, 0, 1 if err.number<>0 then dim errm errm = Array(err.number, err.source, err.description) on error goto 0 Err.Raise errm(0), errm(1), errm(2) & " " & Sql end if on error goto 0 RecordCount = rs(0) rs.close if RecordCount = 0 then AbsolutePage = 1 PageCount = 1 exit sub end if if maxRecords<>0 then RecordCount = smallerOf(RecordCount, maxRecords) end if if isEmpty(FirstPageSize) then FirstPageSize = PageSize end if if RecordCount <= FirstPageSize then PageCount = 1 else PageCount = int((RecordCount - FirstPageSize) / (PageSize + 0.000000001)) + 2 end if if AbsolutePage="" or not isnumeric(AbsolutePage) then AbsolutePage = 1 else AbsolutePage = AbsolutePage + 0 end if if AbsolutePage < 1 then AbsolutePage = 1 if AbsolutePage > PageCount then AbsolutePage = PageCount on error resume next rs.open Sql, conn, 0, 1 if err.number<>0 then errm = Array(err.number, err.source, err.description) on error goto 0 Err.Raise errm(0), errm(1), errm(2) & " " & Sql end if on error goto 0 ' rs.CacheSize = PageSize mFields.RemoveAll dim i for i=0 to rs.Fields.count-1 if not mFields.Exists(Lcase(rs.Fields(i).name)) then mFields.add Lcase(rs.Fields(i).name), i end if next dim dps dps = PageSize if AbsolutePage = 1 then dps = FirstPageSize end if if AbsolutePage>1 then rs.move FirstPageSize + (AbsolutePage-2) * PageSize end if Count = smallerOf(dps, RecordCount - (FirstPageSize + (AbsolutePage-2) * PageSize)) dbArr2 = rs.GetRows(Count) rs.close set rs = nothing End Sub public sub Execute2(ByRef conn) dim rs : set rs = CreateObject("Adodb.Recordset") rs.CursorLocation = 3 on error resume next rs.open Sql, conn, 3, 1 if err.number<>0 then dim errm errm = Array(err.number, err.source, err.description) on error goto 0 Err.Raise errm(0), errm(1), errm(2) & " " & Sql end if on error goto 0 ' rs.CacheSize = PageSize RecordCount = rs.recordcount Count = RecordCount mFields.RemoveAll dim i for i=0 to rs.Fields.count-1 if not mFields.Exists(Lcase(rs.Fields(i).name)) then mFields.add Lcase(rs.Fields(i).name), i end if next if RecordCount = 0 then exit sub end if dbArr2 = rs.GetRows() rs.close set rs = nothing end sub public default property get Value(ByVal index) if not (BOF or EOF) then dim index_ if typename(index)="Integer" then if index >= 0 and index <= ubound(dbArr2, 1) then index_ = index else Err.Raise vbObjectError + 396481, "DataSet", "在对应所需名称或序数的集合中,未找到项目。" end if else if mFields.Exists(Lcase(index)) then index_ = mFields(Lcase(index)) else Err.Raise vbObjectError + 396481, "DataSet", "在对应所需名称或序数的集合中,未找到项目。" end if end if Value = dbArr2(index_ , (AbsolutePosition-1)) else Err.Raise &H800a0bcd, "DataSet", "BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。" end if end property public property get Fields set Fields = mFields end property public property get Pos Pos = (AbsolutePage-1) * PageSize + AbsolutePosition end property public property get BOF BOF = Count=0 or AbsolutePosition=0 end property public property get EOF EOF = Count=0 or AbsolutePosition=(Count+1) end property public sub MoveFirst() AbsolutePosition = 1 end sub public sub MoveLast() AbsolutePosition = Count end sub Public Sub MoveNext() If AbsolutePosition <= Count Then AbsolutePosition = AbsolutePosition + 1 Else Err.Raise vbObjectError + 100, "DataSet.MoveFirst", "EOF" End If End Sub Public Sub MovePrevious() If AbsolutePosition >= 1 Then AbsolutePosition = AbsolutePosition - 1 Else Err.Raise vbObjectError + 100, "DataSet.MovePrevious", "BOF" End If End Sub private function smallerOf(first, second) smallerOf = first if first > second then smallerOf = second end if end function End Class %>