比如我要创3级分类第一类为Article,创建后自动创建一个文件夹Article
2级分类Asp,Asp.net每一级分别在Article这个文件夹里分别创建Asp,asp.net的文件夹
3级分类Vbscript,jscript,C#,Vb.net,Vbscript和jscript也自动能创建在Asp文件夹中的文件夹,C#,Vb.net在Asp.net中.
<%
'程序的核心是一个数组,显示的结果只是比较常见的两种情况,只读取了一次数据库
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{font-size:9pt;font-family:"dotuml";color:#000000;}
body {background-color:#ffffff;scrollbar-base-color:#d0d0c8}
a:hover{ color:#000000 ;}
a:link,a:active,a:visited{text-decoration:none ;color:#ff4500}
.btn {background-color: #d0d0c8; height: 21px; top: 1px; width: 21px; }
-->
</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=")
%>