ASP 生成静态新闻列表
来源:风之相随blog 发布时间:2009-03-03 12:25:00
<!--#include file="conn/conn.asp"-->
<%
set Newslist =server.createobject("adodb.recordset")
PSQL= "select * from News where show =true and ClassID=53 order by Tuijian desc ,id desc"
Newslist.Open PSQL,conn,0,2,1
Newslist.PageSize = 25 '这里设定每页显示的记录数
totalpage=Newslist.pagecount
totallist=Newslist.PageSize
'===================设置页面内分页链接=============================
for j=1 to totalpage
if j=1 then
textname="Index.html"
else
textname="Index-"&j&".html"
end if
textnamelink=textname
listpagelink=listpagelink&"<a href='"&textnamelink&"'>"&j&"</a> "
Next
'===================设置页面内分页链接==========================
for i=1 to totalpage
whichpage=i
Newslist.AbsolutePage=whichpage
howmanyinfo=0
'开始读列表
for l=1 to totallist
if Newslist.EOF or Newslist.BOF then exit for
ContentList=ContentList&"<a href='"&Newslist("classid")&"' target='_blank'>"&Newslist("title")&"</a><br>"
Newslist.movenext
next
ContentList="<table width='100%' border='0' cellpadding='0' cellspacing='0' >"&ContentList&"<br><center>"&listpagelink&"</center></table>"
for t=1 to totalpage
'创建要生成的各文件名
if t=1 then
textname="Index.html"
else
textname="Index-"&t&".html"
end if
Next
DocumentPath=all_tree&"/"&textName '生成静态页全路径!
'创建要生成的各文件名
Folder="./news" '定义父文件夹名称##########################
All_tree=server.mappath(Folder) '静态也的文件路径!
TemplatePath="templates/0529.dwt"
'************************************************************************
Dim fso,htmlwrite
Set fso=Server.CreateObject("Scripting.FileSystemObject") '创建文件系统对象
Set htmlwrite=fso.OpenTextFile(Server.MapPath(TemplatePath)) '打开网页模板文件,读取模板内容
strOut=htmlwrite.ReadAll
htmlwrite.close
'===================模板内容转换========================
'************************************************************************
strTitle="迅风工作室,网站设计,软件开发,网页设计,程序定制,程序修改"
strContent=ContentList
strOut=Replace(strOut,"$title$",strTitle)
strOut=Replace(strOut,"$list$",strContent)
strOut=replace(strOut,"$keyword$",strkeyword)
'************************************************************************
'===================模板内容转换完成====================
Set htmlwrite=fso.CreateTextFile(DocumentPath,true) '创建要生成的静态页
htmlwrite.WriteLine strOut '写入网页内容
htmlwrite.close
response.write "正在生成第"&i&"个页面!<br>"
next
'释放文件系统对象
set htmlwrite=Nothing
set fso=Nothing
%>
猜你喜欢
- 本文实例讲述了Python中dictionary items()系列函数的用法,对Python程序设计有很好的参考借鉴价值。具体分析如下:先
- ddt 是第三方模块,需安装, pip install ddtDDT包含类的装饰器ddt和两个方法装饰器data(直接输入测试数据)通常情况
- 随着“ * ”建设的逐步深入和 * 信息化的高速发展, * 计算机应用系统被广泛应用在各警种、各部门。与此同时,应用系统体系的核心、系统数据的
- 1.算法:设有一组关键字{ K 1 , K 2 ,…, K n };排序开始就认为 K 1 是一个有序序列;让 K 2 插入上述表长为 1
- Python 读取 .gz 文件读取.gz 文件需要使用gzip 包,如果没有安装可以自行在终端安装pip install gzipimpo
- 命名一直是个让我头痛的问题,特别是那些看上去差不多的模块,所以就得想办法啦,我总结了下面的方法,虽然还在试验中。希望对大家有帮助。欢迎大家提
- js监听浏览器回车事件,可以支持ie6+,火狐,谷歌等浏览器。<html><head><script type
- 示例如下:<script> //函数: 反复执行的代码块 //全局只有一个对
- 比如现在有一人员表 (表名:peosons)若想将姓名、身份证号、住址这三个字段完全相同的记录查询出来 select p1.* &
- 前言Laravel是一个简单优雅的PHP Web开发框架,可以将开发者从意大利面条式的代码中解放出来,通过简单、高雅、表达式语法开发出很棒的
- 以下是作者在学习Python中django框架时的学习笔记,并把测试的代码做了详细分析,最后还附上了学习心得,值得大家学习。URL配置(UR
- 网页中使用flash可以增强页面的动态交互效果,特别是用flash来制作广告,效果更好。经常使用flash的人,可能就碰到了flash会遮住
- 之前用Python 2.7版本的httplib做接口测试时,运行代码都是正常的,最近开始用Python 3.3之后,再去看以前的代码,发现i
- 这篇文章主要介绍了python中的引用和拷贝实例解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友
- 之前写爬虫程序的时候,采用生产者和消费者的模式,利用Queue作为生产者进程和消费者进程之间的同步队列。执行程序时,总是秒退,加了断点也无法
- swagger介绍Swagger本质上是一种用于描述使用JSON表示的RESTful API的接口描述语言。Swagger与一组开源软件工具
- Python代码运行助手可以让你在线输入Python代码,然后通过本机运行的一个Python脚本来执行代码。原理如下:在网页输入代码:点击R
- 前言最近在项目中需要输出彩色的文字来提醒用户,以前写过,但是只能在win上面运行。今天搜了下看有没有在win和Linux上通用的输出彩色文字
- 框架介绍在之前的.NET中,微软还没有提供过像样的日志框架,目前能用的一些框架比如Log4Net、NLog、CommonLogging使用起
- python函数式编程之装饰器1.开放封闭原则简单来说,就是对扩展开放,对修改封闭。在面向对象的编程方式中,经常会定义各种函数。一个函数的使