asp和php无限级别分类

赶时间,谁有相关的源码或者相关文章请发我的邮箱394731189@qq.com请不要去网上一搜,连看都没仔细看过随便拷贝一篇文章的链接地址给我,那样的事我也会,网上的文章... 赶时间,谁有相关的源码或者相关文章请发我的邮箱394731189@qq.com请不要去网上一搜,连看都没仔细看过随便拷贝一篇文章的链接地址给我,那样的事我也会,网上的文章我看过不少于10篇,真的看不懂。 请大家帮帮忙,谢谢~~~~~~~~~~~~~~~~~~~~~~~ 展开
 我来答
fqxdcvouun
2011-08-25 · TA获得超过311个赞
知道答主
回答量:663
采纳率:100%
帮助的人:384万
展开全部
<%
'程序的核心是一个数组,显示的结果只是比较常见的两种情况,只读取了一次数据库
Dim LID,CID,TID,OID,Tmp,Url,Bof,Eof,i,ReadSQL,PgNum,PgSiz,Arr,reID,AllRs,LinkStr,
ReadPgSiz,ReadPgNum,ReadAllFd,ReadAllPg,ReadAllRs,ReadRsNum
Db = "test.mdb"
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db)
Set conn = Server.createObject("ADODB.Connection")
conn.open ConnStr
Set NET = New Class_NET
Class Class_NET
function Read(ReadSQL,PgNum,PgSiz)
ReadSQL =(Replace(ReadSQL,"'",""))
ReadPgSiz=Int(PgSiz)
ReadPgNum=Int(PgNum)
Set ReadRs= Server.createObject("ADODB.Recordset")
ReadRs.open ReadSQL,conn,1,1
ReadRs.PageSize =ReadPgSiz
ReadAllFd =ReadRs.Fields.Count
ReadAllPg =ReadRs.PageCount
ReadAllRs =ReadRs.RecordCount
ReadRsNum =ReadRs.Absoluteposition
If int(ReadPgNum)>Int(ReadAllPg) or int(ReadPgNum)=0 Then ReadPgNum=1
ReadRs.absolutepage=ReadPgNum
'返回实际的页面记录条数
If int(ReadPgNum)=Int(ReadAllPg) Then ReadPgSiz=ReadAllRs-ReadPgSiz*(ReadAllPg-1)
'数组开始
reDim ReadRsArr(ReadAllFd-1,ReadPgSiz-1)
For ReadArrRs = 0 to ReadPgSiz-1
If ReadRs.Eof Then Exit For
For ReadArrFd = 0 to ReadAllFd-1
ReadRsArr(ReadArrFd,ReadArrRs)=ReadRs(ReadArrFd)
Next
ReadRs.MoveNext
Next
Read=ReadRsArr
End function
'=====================================================
function ClassPath(Arr,reID,AllRs,Url,LinkStr)
Tmp=Null
reID=Int(reID)
If reID=0 Then Exit function
For i=0 to AllRs-1
If int(Arr(5,i))=int(reID) Then
OID=Arr(0,i)
LID=Arr(1,i)
Exit For
End If
Next
For i=i to 0 step -1
If Arr(1,i)<=LID Then
Tmp=LinkStr&"<a href="&Url&Arr(5,i)&">"&Arr(6,i)&"</a>"&Tmp
LID=LID-1
End If
Next
ClassPath=Tmp
End function
'=====================================================
Sub SetBofEof(Arr,reID,AllRs)
If reID=0 Then
Bof=0
Eof=AllRs-1
Else
For i=0 to AllRs-1
If Arr(5,i)=reID Then
Bof=i
For j=i+1 to AllRs-1
If Arr(1,j)<=Arr(1,i) Then
Eof=j-1
Exit For
End If
If j=AllRs-1 Then Eof=AllRs-1
Next
Exit For
End If
Next
End If
End Sub
'=====================================================
function ClassList(Arr,reID,AllRs,Url)
Tmp=Null
reID=Int(reID)
Call Net.SetBofEof(Arr,reID,AllRs)
'下边这两条实现不显示总分类的功能
If reID>0 Then Bof=Bof+1
For i=Bof to Eof
For j=1 to Arr(1,i)-Arr(1,Bof)
Tmp=Tmp&" "
Next
For k=i+1 to AllRs-1
If Int(Arr(2,k))=Int(Arr(2,i)) Then
Tmp=Tmp&"┝"
Exit For
Else
If k=AllRs-1 Then
Tmp=Tmp&"┕"
Exit For
End If
End If
Next
If i=AllRs-1 Then Tmp=Tmp&"┕"
Tmp=Tmp&"<a href="&Url&Arr(5,i)&">"&Arr(6,i)&"</a><br>"
Next
ClassList=Tmp
End function
End Class
Dim reClass
reClass=request("Class")
If reClass="" or Int(reClass)<1 Then reClass=0
Dim ClassArr
ClassArr=NET.Read(" select * From Class where LID<20 Order by OID",1,999)
Dim ClassAllRs
ClassAllRs=ReadAllRs
%>
<style type="text/css">
<!--
body,a,table,div,span,td,th,input,select
body
a:hover
a:link,a:active,a:visited
.btn
-->
</style>
<%
Response.Write "当前栏目的显示"
Response.Write "<br>"
Response.Write NET.ClassPath(ClassArr,reClass,ClassAllRs,"?Class=",">>>")
Response.Write "<br>"
Response.Write "栏目列表的显示"
Response.Write "<br>"
Response.Write NET.ClassList(ClassArr,reClass,ClassAllRs,"?class=")
%>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
Storm代理
2023-08-29 广告
"StormProxies是全球大数据IP资源服务商,其住宅代理网络由真实的家庭住宅IP组成,可为企业或个人提供满足各种场景的代理产品。点击免费测试(注册即送1G流量)StormProxies有哪些优势?1、IP+端口提取形式,不限带宽,I... 点击进入详情页
本回答由Storm代理提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式