📄 news_list.asp
字号:
<%
'功能:显示新闻
'参数:request("Style")=int #当前栏目; request("page")=int #当前页码
%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<%
'response.buffer=false
'------------------------------------------------设置参数
LoginID=trim(session("LoginID")) : if LoginID="" then LoginID=0 '当前用户ID
maxmessage=15 '每页显示记录数
currentpage=request("page") '当前页码
Style=request("Style"):if Style="" then Style=0 '当前栏目
'------------------------------------------------
'------------------------------------------------取记录
'分页取新闻记录 (返回rs对象)
'rs.recordcount 为记录总数
'rs.PageSize 为本页记录数
'
set rs=Server.CreateObject("ADODB.RecordSet")
sql="SELECT tbioaInfomation.*,tbioaUser.Name from tbioaInfomation join tbioaUser on sender=tbioaUser.ID WHERE newsort=" & Style & " order by newsdate desc"
'response.write sql
rs.open sql,oConn,1,1
Showpage=Paging(rs,maxmessage,currentpage,"Style="&Style)
'------------------------------------------------
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css" type=text/css>
<title>main</title>
<base target="FrmMain">
</head>
<body topmargin="10" leftmargin="10">
<table border=0 cellspacing="0" cellpadding="0">
<tr>
<td width="120"><img border="0" src="../images/icon_menu.gif" align="left"><a href="news_index.asp">新闻中心</a></td>
</tr>
</table>
<hr width="100%" size=1 color="#000000">
<br>
<%=Showpage%>
<br>
<%
if rs.RecordCount=0 then
response.write "<BR><BR>暂时为空!"
else
%>
<table width="100%" cellspacing="1" cellpadding="2" class="tab">
<tr>
<td class="tdTop">标题</td>
<td width="80" class="tdTop">发布者</td>
<td width="50" class="tdTop">阅读</td>
<td width="70" class="tdTop">发布时间</td>
</tr>
<%for i = 0 to rs.PageSize-1 '循环
If rs.EOF Then Exit For
if i mod 2 = 0 then td_class="td1" else td_class="td2"
%>
<tr>
<td class="<%=td_class%>"><a href=news_detail.asp?id=<%=rs("id")%> target="_blank"><%=rs("title")%></a></td>
<td class="<%=td_class%>"><%=rs("Name")%></td>
<td class="<%=td_class%>"><%=rs("hits")%>(人)</td>
<td class="<%=td_class%>"><%=year(rs("newsdate")) & "-" & month(rs("newsdate")) & "-" & day(rs("newsdate"))%></td>
</tr>
<%
rs.MoveNext
next
%>
</table>
<%
end if
rs.close
%>
</body>
</html>
<%'释放对象变量
oConn.close
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -