%
'Option Explicit
%>
<%
Dim Cfg, Db, FLib
Set Cfg = Server.CreateObject("OnewPro.Config")
set Db = Server.CreateObject("OnewPro.DBControl")
Set FLib = Server.CreateObject("OnewPro.FunctionLib")
Db.COpen()
Dim RCid,id, ClassTitle, sType, sKey, ResStatus, ResStatus_Title
Dim CurrPage, PageSize, TotalNum, PageCount, UrlInfo
Dim Rs, Sql
RCid = FLib.SafeSql(Request("id"))
ClassTitle = Trim(Request("ClassTitle"))
CurrPage = FLib.SafeSql(Request("CurrPage"))
PageSize = 20
If Not IsNumeric(RCid) OR RCid = "" Then
RCid = 0
End If
If Not IsNumeric(CurrPage) OR CurrPage = "" Then
CurrPage = 1
End If
Sql = ExeSql(0)
Set Rs = Db.ExeCute(CSTR(Sql))
TotalNum = Rs("xcount")
Rs.Close()
PageCount = CInt(TotalNum / PageSize)
If TotalNum Mod PageSize <> 0 Then
PageCount = PageCount + 1
End If
Sql = ExeSql(1)
Set Rs = Db.CreateRS
Rs.PageSize = PageSize
Rs.CacheSize = Rs.PageSize
Rs.Open Sql, Db.Conn, 1, 1
If Not(Rs.Eof And Rs.Bof) Then
Rs.AbsolutePage = CurrPage
End If
UrlInfo = "&id=" & RCid
function repl(str)
str=replace (str,"'","")
str=replace (str,chr(34),"")
str=replace (str,chr(13),"")
str=replace (str,chr(10),"")
str=replace (str,";","")
repl=str
end function
function showContent(str,num)
if len(trim(str))>num then
response.write left(trim(str),num)&"..."
else
response.write trim(str)
end if
end function
Function FilterSign(str)
Dim strTemp
strTemp = str
While Instr(1,strTemp,"<")
strL = Left(strTemp, Instr(1, strTemp, "<")-1)
strR = Right(strTemp, Len(strTemp)-Instr(1,strTemp,">"))
strTemp = strL & strR
Wend
strTemp = replace(strTemp, " ", "")
strTemp = Replace(strTemp, " ","")
FilterSign = strTemp
End Function
Function Path_ResClassList(Id , Url)
Dim sql
Dim rs
Dim PId, title, Ostr
sql = "execute parent_res_class_list '" & Id & "'"
Set rs = Db.CreateRS
rs.Open sql, Db.Conn, 3, 1
' If Rs.Eof And Rs.Bof Then
' Rs.Close
' Set Rs = Nothing
' Exit Function
' End If
Path_ResClassList = "首页"
While (Not rs.EOF)
PId = rs("id")
title = rs("title")
home_url = rs("home_url")
If Path_ResClassList <> "" Then
Path_ResClassList = Path_ResClassList & " > " & title & ""
Else
Path_ResClassList = "" & title & ""
End If
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
End Function
%>
<%
sql="select id,title from res_class_list where id = " & RCid
dim rs2
Set Rs2 = Db.CreateRS
Rs2.Open Sql, Db.Conn, 1, 1
%>
新京报-<%=rs2("title")%>
当前位置:
<%
'dim a
'a = FLib.Path_ResClassList(cint(rs2("ID")),"?")
Dim path
path = Path_ResClassList(cint(rs2("ID")),"http://news.thebeijingnews.com/")
response.write path
rs2.close()
set rs2=nothing
%>
<%
Dim CurrNum
'PageCount
'CurrPage
If Not IsNumeric(CurrPage) OR CurrPage = "" Then
CurrNum = TotalNum
Else
If CInt(CurrPage) < CInt(TotalNum / PageSize) Then
CurrNum = PageSize
Else
CurrNum = TotalNum Mod PageSize
End If
End If
%>
<%
Dim bgColor
bgColor = "#F6F6F6"
Dim i
i=1
While Not Rs.Eof
If bgColor = "#F6F6F6" Then
bgColor = "#FFFFFF"
Else
bgColor = "#F6F6F6"
End If
%>
<%=ShowTitle(Rs)%> [<%=Rs("addtime")%> ]
<%=showContent(FilterSign(Rs("content")),150)%>
<%
i = i + 1
Rs.MoveNext
Wend
If Rs.Eof And Rs.Bof Then
%>
暂无相关新闻
<%
End If
%>
<%
Function ExeSql(m)
Dim Sql
If m = 1 Then
Sql = "SELECT TOP " & (CurrPage * PageSize) & " id, title,class_title, class_id, checked, deleted, created, go_url,addtime, creator, visit_url, content FROM view_resource_all WHERE {WHERE} ORDER BY id DESC"
Else
Sql = "SELECT COUNT(id) as xcount FROM view_resource_all WHERE {WHERE}"
End If
Sql = Replace(Sql, "{WHERE}", ExeSql_WHERE())
ExeSql = Sql
End Function
Function ExeSql_WHERE()
Dim Sql
Sql = ""
If RCid <> 0 Then
If Sql <> "" Then
Sql = Sql & " AND "
End If
Dim ChildList
ChildList = FLib.ChildenList(CINT(RCid))
'
Dim v ,i
v = Split(ChildList,",")
For i = 0 To UBound(v)
If FLib.ChildenList(CINT(v(i)))<>"" Then
ChildList = ChildList &","& FLib.ChildenList(CINT(v(i)))
End If
Next
'
If ChildList <> "" Then
ChildList = RCid & "," & ChildList
Else
ChildList = RCid
End If
Sql = Sql & "class_id IN (" & ChildList & ")"
Sql = Sql & " AND Deleted=0 AND Checked=1 AND created=1"
Else
Sql = " 1=2"
End If
ExeSql_WHERE = Sql
End Function
Function ShowTitle(Rs)
select case Rs("go_url")
case ""
If Rs("visit_url")<>"" Then
ShowTitle = "" & Rs("title") & ""
End If
case Else
ShowTitle = "" & Rs("title") & ""
End select
End Function
%>
<%
Db.CClose()
set Cfg = nothing
set Db = nothing
set FLib = nothing
%>