⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 news.asp

📁 asp
💻 ASP
字号:
<%response.expires=0%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/code.asp"-->
<%
id=strFilter(request("id"),10)
if id="" then
  call msgbox("请正确指定浏览文章!",1)
end if
if not isnumeric(id) then
  call msgbox("请正确指定浏览文章!",1)
end if
id=CCur(id)
sql="select top 1 title,pic,content,author,source,otime,path,filenum,skey,categoryid from news where id="&id
rs.open sql,conn,1,1
if not rs.eof then
  title		=rs(0)
  pic		=rs(1)
  content	=rs(2)
  author	=rs(3)
  source	=rs(4)
  otime		=rs(5)
  filepath	=rs(6)
  filenum	=rs(7)
  skey		=rs(8)
  categoryid	=split(rs(9),".")
else
  rs.close
  call msgbox("该新闻不存在!",1)
end if
rs.close

sql="select top 1 categoryname,categoryindex,categorymode from category where categoryid="&categoryid(1)
rs.open sql,conn,1,1
if not rs.eof then
  cname=rs(0)
  cindex=split(rs(1),".")
  cmode=rs(2)
else
  rs.close
  call msgbox("该分类不存在!",1)
end if
rs.close

if isNull(cmode) then
  sql="select top 1 categorymode from category where categoryindex like '"&cindex(0)&"."&cindex(1)&"'"
  rs.open sql,conn,1,1
  if not rs.eof then
    cmode=rs(0)
  end if
  rs.close
end if

if isarray(cindex) then
  for i=0 to ubound(cindex,1)
    if nindex="" then
      nindex=cindex(0)
    else
      nindex=nindex&"."&cindex(i)
    end if
    sql="select top 1 categoryid,categoryname,categorypath from category where categoryindex like '"&nindex&"'"
    rs.open sql,conn,1,1
    if not rs.eof then
      if i=1 then
        categorydir=rs(2)
        toppath=toppath&"<a href=""/news/"&rs(2)&""">"&rs(1)&"</a> >> "
      else
        toppath=toppath&rs(1)&" >> "
      end if
    else
      rs.close
      call msgbox("该分类上级不存在!",1)
    end if
    rs.close
  next
  sql="select categoryname,categorysort,categoryindex from category where categoryindex like '"&cindex(0)&".%'"
  rs.open sql,conn,1,1
  if not rs.eof then
    categoryselect=rs.getrows
  end if
  rs.close
end if

if isarray(categoryselect) then
  for i=0 to ubound(categoryselect,2)
    cselect=split(categoryselect(2,i),".")
    if ubound(cselect,1)=1 then categoryitem=categoryitem&"<option value="""&categoryselect(1,i)&""">"&categoryselect(0,i)
  next
end if

sql=""
if (skey="" or isNull(skey)) and ubound(cindex)=2 then
  sql="select top 10 id,title,pic,otime,path,filenum from news where categoryid like '%."&categoryid(1)&".%'"
end if
if skey><"" then
  sql="select top 10 id,title,pic,otime,path,filenum from news where title like '%"&skey&"%'"
end if
if sql><"" then
  sql=sql&" order by otime DESC, hits DESC"
  rs.open sql,conn,1,1
  if not rs.eof then
    aboutlist=rs.getrows()
  end if
  rs.close
end if

Set rs=nothing
Set conn=nothing

if isarray(cindex) then
  if ubound(cindex)<2 then
    toptitle="最新新闻"
    topjs="<script language=""javascript"" src=""/news/list.asp?id="&categoryid(1)&"&height=15""></script>"
    tophtml="<script language=""javascript"" src=""/news/html.asp?id="&categoryid(1)&"&height=15""></script>"
    abouttitle="相关新闻"
  else
    toptitle="本专题新闻浏览排行"
    topjs="<script language=""javascript"" src=""/news/list.asp?id="&categoryid(1)&"&order=hits&height=15""></script>"
    tophtml="<script language=""javascript"" src=""/news/html.asp?id="&categoryid(1)&"&height=15""></script>"
    abouttitle="专题新闻"
  end if
end if

if isarray(aboutlist) then
  for i=0 to ubound(aboutlist,2)
aboutnewshtml=aboutnewshtml&" ·<a href=""/"&aboutlist(4,i)&aboutlist(5,i)&".htm"">"&aboutlist(1,i)&"</a>"
aboutnewsid=aboutnewsid&" ·<a href=""/news/news.asp?id="&aboutlist(0,i)&""">"&aboutlist(1,i)&"</a>"
if aboutlist(2,i)=true then
  aboutnewshtml=aboutnewshtml&"[<font color=D669A5>图</font>]"
  aboutnewsjs=aboutnewsjs&"[<font color=D669A5>图</font>]"
end if
aboutnewshtml=aboutnewshtml&" <font color=888888>("&aboutlist(3,i)&")</font><br>"&vbcrlf
aboutnewsjs=aboutnewsjs&" <font color=888888>("&aboutlist(3,i)&")</font><br>"&vbcrlf
  next
end if

content=UBBCode(content)

cmode=replace(cmode,"[toptitle]",toptitle)
cmode=replace(cmode,"[topjs]",topjs)
cmode=replace(cmode,"[tophtml]",tophtml)
cmode=replace(cmode,"[toppath]",toppath)
cmode=replace(cmode,"[category]",categorydir)
cmode=replace(cmode,"[categoryitem]",categoryitem)

cmode=replace(cmode,"[title]",title)
cmode=replace(cmode,"[time]",otime)
if author><"" then
  cmode=replace(cmode,"[author]",author)
else
  cmode=replace(cmode,"[author]","")
end if
if source><"" then
  cmode=replace(cmode,"[source]",source)
else
  cmode=replace(cmode,"[source]","")
end if
cmode=replace(cmode,"[content]",content)

cmode=replace(cmode,"[abouttitle]",abouttitle)
cmode=replace(cmode,"[aboutnewshtml]",aboutnewshtml)
cmode=replace(cmode,"[aboutnewsid]",aboutnewsid)

response.write cmode
response.end
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -