1。怎么写调用数据库部分栏目(部分二级栏目);2。如何通过数据库实现下拉的菜单(包含二,三级栏目)
我用的是http://www.wenday.com的网站信息系统,在那里提问,好几天都没人回答。
请社区的朋友帮帮忙,我急啊!每个问题50分,得到答案,马上结帖给分。
1。怎么写调用数据库部分栏目的文章(部分二级栏目);
以下是代码:
<%
dim sqlsort
dim RsSort
sqlsort="select * from Sort where B_id=0 and setting < 4 order by S_order"
Set RsSort=conn.execute (sqlsort)
if RsSort.eof and RsSort.bof then
response.write "<div align=center>还没有任何栏目</div>"
else
do while not RsSort.eof
%> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TR>
<TD width="6%" background=Img/Ew_BarBg.gif height=34>
<img src="Img/Ew_Bar.gif" width="55" height="34"></TD>
<TD width="94%" background=Img/Ew_BarBg.gif><a href="Sort.asp?SortID=<%=RsSort(0)%>"><%=RsSort(1)%></a></TD>
</TR>
</TABLE>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="35%" height="106" align="center">
<%
set RsPic=server.createobject("adodb.recordset")
sql="select top 1 * from Info where Sort1="&RsSort("id")&" and Ispic=1 ORDER BY ADDdate desc,id DESC"
RsPic.open sql,conn,1,1
if RsPic.eof or RsPic.bof then
Call NoPic("本类暂无图文信息")
end if
do while not RsPic.eof
Call Ew_ShowPic(RsPic("Pic"),RsPic(0),RsPic("Title"),140,110,17)
RsPic.movenext
loop
RsPic.close
set RsPic=nothing
%> </td>
<td width="65%" valign="top"> <% Call Ew_ShowInfo(5,Sort_Count,35,RsSort("id"),1) %> </td>
</tr>
</table>
<%
RsSort.movenext
loop
end if
RsSort.close
set RsSort=nothing
%>
2。如何通过数据库实现下拉的菜单(包含二,三级栏目)
差不多 http://emba.gsm.pku.edu.cn/的风格,但要加(半透明的)下拉菜单
以下是代码:
<%
sql="select * from Sort where B_id=0 order by s_order"
Set rs=conn.execute (sql)
if rs.eof and rs.bof then
response.write "没有栏目"
else
do while not rs.eof
Id=Request("SortID")
%>
<td align="center"><a href="Sort.asp?SortID=<%=rs("ID")%>">
<%if rs("id")=id then%>
<font color=#FF0000><%=rs("Names")%></font>
<%else%>
<%=rs("Names")%>
<%end if%>
</a></td>
<%
rs.movenext
loop
end if
rs.close
%>