<%
dim larcode(100) '最多支持100个大类
dim midcode(200) '最多支持20个中类
dim larroot(200) '最多支持20个中类
dim larid(200) '最多支持20个中类
dim larcolor(200) '最多支持20个中类
dim midcolor(200) '最多支持20个中类
dim midid(200)
'以下是分类列表,首先读取全部大类,然后根据每个大类读取各自的中类
Dim a,b,c
sqllar="select Distinct catname,parentid,strcolor,rootid,parentstr,catid from cat where parentstr='0' order by rootid"
Set rsprodtree=Server.CreateObject("ADODB.RecordSet")
rsprodtree.Open sqllar,conn,1,1
if rsprodtree.bof and rsprodtree.eof then
response.write "对不起,暂无分类"
else
i=0
Do While Not rsprodtree.eof
i=i+1
larcode(i)=rsprodtree("catname")
larcolor(i)=rsprodtree("strcolor")
larid(i)=CStr(rsprodtree("catid"))
rsprodtree.movenext
if rsprodtree.eof then exit do
Loop
end if
set rsprodtree=nothing
set sqllar=nothing
FOR t=1 to i
response.write "
"
if larcolor(t)="" then
response.write ""&LarCode(t)&""
else
response.write "
"&LarCode(t)&""
end if
'以下是根据前面读取的大类名称,读取各个大类下的中类
sqllar="select catname,parentid,strcolor,rootid,parentstr,catid from cat where parentstr='"&larid(t)&"' and depth=1 order by orders"
Set rsprodtree=Server.CreateObject("ADODB.RecordSet")
rsprodtree.Open sqllar,conn,1,1
erjizong=rsprodtree.RecordCount
m=0
Do While Not rsprodtree.eof
m=m+1
midcode(m)=rsprodtree("catname")
midcolor(m)=rsprodtree("strcolor")
midid(m)=CStr(rsprodtree("catid"))
rsprodtree.movenext
if rsprodtree.eof then exit do
Loop
set rsprodtree=nothing
set sqllar=nothing
w=0
for n=1 to m
w=w+len(MidCode(n))
if midcolor(n)="" then
if w>18 then
response.write "
"
w=len(MidCode(n))
end if
response.write "
"&MidCode(n)&""
if n<>erjizong then
w=w+3
if w+len(MidCode(n+1))<19 then
response.write " | "
end if
end if
else
if w>18 then
response.write "
"
w=len(MidCode(n))
end if
response.write "
"&MidCode(n)&""
if n<>erjizong then
w=w+3
if w+len(MidCode(n+1))<19 then
response.write " | "
end if
end if
end if
next
response.write "
"
next
%>