网络编程 
首页 > 网络编程 > 浏览文章

上一篇,下一篇过程代码

(编辑:jimmy 日期: 2025/2/27 浏览:3 次 )
Rem==上一篇==
Rem================================================================ Rem= 参数说明:
Rem= pid当前ID,prame:栏目前辍(如一般web_news表,字段时一般为wn_**,prame就代表wn)
Rem= ptable(表前辍.如一般表名是:站点名_表名(shenzhe_news) ptable:就代表shenzhe)
Rem= 说明:采用上面命名法,可使该过程达到通用
Rem===============================================================
Function GetPre(pid,prame,ptable)
    id = prame&"_id"
title = prame&"_title"
table = "city_"&ptable
url = "show_"&ptable
sql = "SELECT TOP 1 "&id&","&title&" FROM "&table&" WHERE "&id&"<"&pid&" ORDER BY "&id&" DESC"
set rs = Conn.Execute(sql)
If rs.eof or rs.bof Then
     pre = "上一篇:没有新闻了"
Else
     pre = "<a href="&url&".asp?"&id&"="&rs(0)&">"&rs(1)&"</a>"
End If
GetPre = pre
End Function

Rem = 下一篇
Rem=============
Rem= 参数函意和上过程一样
Rem==========
Function GetNext(nid,nrame,ntable)
    id = nrame&"_id"
title = nrame&"_title"
table = "city_"&ntable
url = "show_"&ntable
sql = "SELECT TOP 1 "&id&","&title&" FROM "&table&" WHERE "&id&">"&nid&" ORDER BY "&id&" "
set rs = Conn.Execute(sql)
If rs.eof or rs.bof Then
     nnext = "下一篇:没有新闻了"
Else
     nnext = "<a href="&url&".asp?"&id&"="&rs(0)&">下一篇:"&rs(1)&"</a>"
End If
GetNext = nnext
End Function

实现代码:
偶数据库里有表:
city_active  city_date  city_note
city_active主要字段有: ca_id,cd_title
city_date主要字段有: cd_id,cd_title
city_note主要字段有: cn_id, cn_title

这样引用就可:
在show_note.asp?cn_id=4里引用上一篇下一篇
<%=GetPre(cn_id,"cn","note")%> ' 上一篇
<%=GetNext(cn_id,"cn","note")%> ' 下一篇
上一篇:一小偷类!!有兴趣的可以看看
下一篇:web文件管理器的后续开发
一句话新闻
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。