帝国软件
  设为首页 加入收藏 关于我们
 
解密帝国网站管理系统
栏 目:
 
您的位置:首页 > 技术文档 > ASP编程
用文本+ASP打造新闻发布系统(三)新闻列表显示
作者:mysoso 发布时间:2005-03-12 来源:开发者俱乐部
<%
dim myfso,myread
set myfso=createobject("scripting.filesystemobject")
set myread=myfso.opentextfile(server.mappath("./new_list.asp"),1,0)

if myread.atendofstream then
Response.Write "目前没有添加新闻"
Response.End
else

dim mytext,listarray
mytext=myread.readall
listarray=split(mytext,"|") '#######把所有记录分割成一个数组a

dim recordcount,pagecount, pagesize, pagenum
recordcount=ubound(listarray)'############记录条数
pagesize=2
pagecount=recordcount/pagesize '#######取得页面数
if instr(1,pagecount,".")=null or instr(1,pagecount,".")=0 then
pagenum=pagecount
else
pagenum=int(pagecount)+1
end if

dim topage
topage=cint(Request.QueryString ("topage")) '########取得要显示的页面
if topage<=0 then
topage=1
end if
if topage>pagenum then
topage=pagenum
end if


dim i,j,n
b=listarray
for i=0 to recordcount-1 '########把每一条记录组成一个数组
j=split(listarray(i),",")
if ubound(j)=6 then
b(i)="<SPAN style='COLOR: #ffbd00; FONT-SIZE: 7px'><li></SPAN><span style='font-size:10pt'><a href='news_view.asp?id=" & j(0) & "' target=blank>" & j(1) & "(图)</a> 点击:" & j(4)&"次 最后发布时间:"&j(5)&"</span>"
else
b(i)="<SPAN style='COLOR: #ffbd00; FONT-SIZE: 7px'><li></SPAN><span style='font-size:10pt'><a href='news_view.asp?id=" & j(0) & "' target=blank>" & j(1) & "</a> 点击:" & j(4)&"次 最后发布时间:"&j(5)&"</span>"
end if
next

'########把记录反排序存储在新的数组实现按时间反排序
dim c(100)
n=0
for i=recordcount to 0 step -1
c(n)=b(i)
n=n+1
next


dim currentrecord
currentrecord=pagesize*(topage-1)+1 '#########显示每一页
for k=1 to pagesize
if len(c(currentrecord))=0 then
exit for
end if
Response.Write c(currentrecord)&"<br>"
currentrecord=currentrecord+1
next
Response.Write "<body bgcolor=#EDF0F5 topmargin=10 marginheight=5 leftmargin=4 marginwidth=0>"
for m=1 to pagenum
response.write "<span style=font-size:10pt><a href=news_list.asp?topage="&m&">"&m&"</a></span> "
next

end if

%>

  
评论】【加入收藏夹】【 】【打印】【关闭
※ 相关链接
 ·用文本+ASP打造新闻发布系统/图片  (2005-03-12)
 ·用文本+ASP打造新闻发布系统(二)  (2005-03-12)

   栏目导行
  PHP编程
  ASP编程
  ASP.NET编程
  JAVA编程
   站点最新
·致合作伙伴的欢迎信
·媒体报道
·帝国软件合作伙伴计划协议
·DiscuzX2.5会员整合通行证发布
·帝国CMS 7.0版本功能建议收集
·帝国网站管理系统2012年授权购买说
·PHPWind8.7会员整合通行证发布
·[官方插件]帝国CMS-访问统计插件
·[官方插件]帝国CMS-sitemap插件
·[官方插件]帝国CMS内容页评论AJAX分
   类别最新
·在ASP中使用数据库
·使用ASP脚本技术
·通过启动脚本来感受ASP的力量
·学习使用ASP对象和组件
·解析asp的脚本语言
·初看ASP-针对初学者
·ASP开发10条经验总结
·ASP之对象总结
·ASP与数据库应用(给初学者)
·关于学习ASP和编程的28个观点
 
关于帝国 | 广告服务 | 联系我们 | 程序开发 | 网站地图 | 留言板 帝国网站管理系统