<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<%
'一级分类
sql="select * from board order by px"                    
Set Rs=Conn.Execute(sql) 
if rs.eof and rs.bof then
	response.Write ("<DIV id=no1 align='center'> 没有分类数据，请从后台添加！</DIV>")
else        
		%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="999999" >
		<%
		
		do while not Rs.eof    
		%>
		
		
		<% 
				'二级分类
				sql2="select * from bbs_class2 where class2_class1_id = "& rs("bid") &" order by class2_class2_px"                    
				Set Rs2=Conn.Execute(sql2) 
				if rs2.eof and rs2.bof then
				'没有二级子类，直接显示一级分类中的信息
				%>
					 <tr bgcolor="f1f1f1">
						<td colspan="4" bgcolor="#CCCCCC">
							<a href="list.asp?bid=<%=rs("bid")%>" ><%=rs("bidname")%></a>
					   </td>
					</tr>
					 <tr bgcolor="#FFFFFF">
						<td   colspan="4" bgcolor="#FFFFFF">
						一级分类/详细
							<%=rs("logo")%>		-
							<%=rs("bidinfo")%>		<br />
							<%=rs("lasttopic")%>	-
							<%=rs("lastname")%>		<br />
							<%=rs("lasttime")%>		-
							<%=rs("rzh")%>			<br />
							<%=rs("username")%>		
					   </td>
					</tr>

				<%
				else        
				'有二级子类，显示一级分类简单信息
				%>
					 <tr bgcolor="f1f1f1">
						<td colspan="4" bgcolor="#CCCCCC">
							<a href="list.asp?bid=<%=rs("bid")%>" ><%=rs("bidname")%></a>
					   </td>
					</tr>

				<%
					do while not Rs2.eof 
							'三级分类
							sql3="select * from bbs_class3 where class3_class2_id = "& rs2("class2_id")&" order by class3_class3_px"                    
							Set Rs3=Conn.Execute(sql3) 
							if rs3.eof and rs3.bof then
							'没有三级子类，直接显示二级分类的新帖字段
					%> 
						<tr  bgcolor="#FFFFFF">
							<td>
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
									  <tr  bgcolor="#FFFFFF">
										<td bgcolor="#BDCBDE">
								<%=rs2("class2_id")%>		-
								<%=rs2("class2_class1_id")%>		-
								<%=rs2("class2_class2_name")%>		
							</td>
						</tr>
						<tr bgcolor="#FFFFFF">
							<td>
								<%=rs2("class2_class2_logo")%>		-
								<%=rs2("class2_class2_info")%>		<br />
								<%=rs2("class2_class2_px")%>		-
								<%=rs2("class2_class2_newtie")%>		<br />
								<%=rs2("class2_class2_user")%>		-
								<%=rs2("class2_class2_time")%>		-
								<%=rs2("class2_class2_admin")%>		-
											
										</td>
									  </tr> </table>
							</td>
						</tr>
							<%
							else 
							'有三级子类，显示二级分类标题
							%>
							<tr bgcolor="#FFFFFF">
							<td>
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
									  <tr >
										<td bgcolor="#BDCBDE">
											<%=rs2("class2_id")%>		-
											<%=rs2("class2_class1_id")%>		-
											<%=rs2("class2_class2_name")%>		-
											
										</td>
									  </tr>

							<%
								'显示三级子类的具体信息
								do while not Rs3.eof  
								%>
									  <tr>
										<td bgcolor="#FFCC00">
											<%=rs3("class3_id")%>
											<%=rs3("class3_class1_id")%>
											<%=rs3("class3_class2_id")%>
											<%=rs3("class3_class3_name")%>
											<%=rs3("class3_class3_logo")%>
											<%=rs3("class3_class3_info")%>
											<%=rs3("class3_class3_px")%>
											<%=rs3("class3_class3_newtie")%>
											<%=rs3("class3_class3_user")%>
											<%=rs3("class3_class3_time")%>
											<%=rs3("class3_class3_admin")%>
										</td>
									  </tr>
								<%
								Rs3.movenext                             
								loop 
								%>
						  </table>
										</td>
									  </tr>
								<%                            
							end if
							rs3.close                              
							set rs3=nothing                            
			
					Rs2.movenext                             
					loop 
				end if                           
				rs2.close                              
				set rs2=nothing                            
		Rs.movenext                             
		loop 
		%>
			                  </table>
			                  <% 
		end if                           
rs.close                              
set rs=nothing                            
%>
