首页新闻有显示推荐内容功能,但是我先实现这样的效果...
asp吧
全部回复
仅看楼主
level 13
金鳌 楼主
首页读取国际新闻一条。
如果国际新闻里面在后台有推荐的新闻,则显示推荐中最新的一条。
如果没有推荐的新闻那么就默认显示最新的一条。
请问大家如何实现那?
代码如下:isGood=true时为推荐的。
---------------------------------------------------------
<%
set rs=server.CreateObject("adodb.recordset")
str="select top 12 * from news where classId=5 order by id desc"
rs.open str,conn,3,1
if not rs.eof and not rs.bof then
i=1
do while not rs.eof
%>
<li>
<a href="/xinwen/article.asp?id=<%=rs("id")%>" target="_blank" title="<%=rs("title")%>">
<%=rs("title")%>
</a>
</li>
<%
rs.movenext
i=i+1
loop
end if
rs.close
set rs=nothing
%>
2015年05月10日 02点05分 1
level 10
把推荐的字段类型设为数值型 排序的时候先按推荐排序 然后按时间排序咯
2015年05月10日 05点05分 2
推荐还能做成第加的吗?
2015年05月10日 13点05分
level 4
修改字段~〈isgood〉为1时为推荐~0时为不推荐~数据库默认0……这样查数据库的时候。order by isgood,id
两个就可以了
2015年05月10日 23点05分 3
level 12
问题描述的很模糊
这个问题 需要 数据库表结构、ASP代码 结合来看
2015年05月11日 00点05分 4
1