<!--#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 %> |