各路高手们,我现在已有的代码上添加上一篇,下一篇,还有显示浏览人数的功能,谁能帮帮我??????

halala123 2003-09-23 09:05:46
以下的代码是完成新闻系统中的新闻显示,有几种不同条件的显示方法,现在我想在显示的页面添加上一篇,下一篇,还有显示浏览人数的功能,可是我不懂怎么添加,请各路高手帮帮我
<%
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,content,skey,author,source,csize,otime,path,categoryid from news where id="&id
rs.open sql,conn,1,1
if not rs.eof then
title =rs(0)
content =rs(1)
skey =rs(2)
author =rs(3)
source =rs(4)
csize =rs(5)
otime =rs(6)
filepath =rs(7)
category =split(rs(8),".")

else
rs.close
call msgbox("该修改新闻不存在!",1)
end if
rs.close
categoryid=category(1)
%>
<%
sql=""
if (skey="" or isNull(skey)) and ubound(cindex)=2 then
sql="select top 10 id,title,pic,otime,path from news where categoryid like '%."&categoryid&".%'"
end if
if skey><"" then
sql="select top 10 id,title,pic,otime,path 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="最新新闻"
topid="<script language=""javascript"" src=""/"&newsdir&"/list.asp?id="&categoryid&"&height=15""></script>"
abouttitle="相关新闻"
else
toptitle="本专题新闻浏览排行"
topid="<script language=""javascript"" src=""/"&newsdir&"/list.asp?id="&categoryid&"&order=hits&height=15""></script>"
abouttitle="专题新闻"
end if
end if

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

%><!--#include file="../admin/inc/code.asp"--><%
content=UBBCode(content)

cmode=replace(cmode,"[HOMEPAGE]",homepage)
cmode=replace(cmode,"[URL]",url)
cmode=replace(cmode,"[NEWS]",newsdir)
cmode=replace(cmode,"[TOPTITLE]",toptitle)
cmode=replace(cmode,"[TOPHTML]",topid)
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,"[ABOUT]",abouttitle)
cmode=replace(cmode,"[ABOUTHTML]",aboutid)

response.write cmode
%>
...全文
47 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
aryou 2003-09-25
  • 打赏
  • 举报
回复
<%
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,content,skey,author,source,csize,otime,path,categoryid,hits from news where id="&id
rs.open sql,conn,1,3 '修改的语句
if not rs.eof then
rs("hits")=rs("hits")+1 '增加的语句
title =rs(0)
content =rs(1)
skey =rs(2)
author =rs(3)
source =rs(4)
csize =rs(5)
otime =rs(6)
filepath =rs(7)
category =split(rs(8),".")
rs.update '增加的语句
else
rs.close
call msgbox("该修改新闻不存在!",1)
end if
rs.close
categoryid=category(1)
%>
aryou 2003-09-25
  • 打赏
  • 举报
回复
<%
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,content,skey,author,source,csize,otime,path,categoryid,hits from news where id="&id
rs.open sql,conn,1,3
if not rs.eof then
rs("hits")=rs("hits")+1
title =rs(0)
content =rs(1)
skey =rs(2)
author =rs(3)
source =rs(4)
csize =rs(5)
otime =rs(6)
filepath =rs(7)
category =split(rs(8),".")
rs.update
else
rs.close
call msgbox("该修改新闻不存在!",1)
end if
rs.close
categoryid=category(1)
%>
halala123 2003-09-23
  • 打赏
  • 举报
回复
那你觉得在我的代码里怎样加才行呀,我加过,可是老是出错,还请你多指点指点
ttt2 2003-09-23
  • 打赏
  • 举报
回复
找一段分页的程序把rs.pagesize=1不记行了吗

update test set llrs=llrs+1 where id=1
halala123 2003-09-23
  • 打赏
  • 举报
回复
没有呀,那每次浏览的时候不是要用一个变量来累加吗,可是我在代码里用到这种方法的时候老是出错,那是怎么回事呀
avonqin 2003-09-23
  • 打赏
  • 举报
回复
得到新闻的ID,就可以从数据库里获得浏览人数了呀。:)
hillhero789 2003-09-23
  • 打赏
  • 举报
回复
用application啦
可以在global.asa里边这么写:
sub application_onstart
application("onlinenum")=0
end sub

sub session_onstart
application("onlinenum").lock
application("onlinenum")=application("onlinenum")+1
application("onlinenum").unlock
end sub

sub session_onend
application.lock
application("onlinenum")=application("onlinenum")-1
application.unlock
end sub
halala123 2003-09-23
  • 打赏
  • 举报
回复
那显示浏览人数,该怎么实现呀?
avonqin 2003-09-23
  • 打赏
  • 举报
回复
id=本篇新闻的id
……其他传递参数

第一步:在Code.asp页面你喜欢的位置写上“[上一篇]”、“[下一篇]”
第二步:cmode=replace(cmode,"[上一篇]","<A href=……/news.asp?id="&id-1&" >[上一篇]</A>")
第三步:cmode=replace(cmode,"[下一篇]","<A href=……/news.asp?id="&id+1&" >[下一篇]</A>")
(注意:上面连接语句还要加上其他传递参数,如:categoryid、skey……)
halala123 2003-09-23
  • 打赏
  • 举报
回复
请问谁有相应的代码提供呀
yangsm 2003-09-23
  • 打赏
  • 举报
回复
加在数据库显示内容的后面就行了

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧