asp生成静态HTML(动态读取)
发布时间:2013-06-27 19:54:48
标签:asp,生成静态HTML
<!--#include file="admin_Checkuser.asp"-->
<%
call ConnectionDatabase()
dim str,str_new
str=""
str_new=""
sqlx="select id from Fl_Products order by id desc"
set rsx=conn.execute(sqlx)
do while not rsx.eof
str=str&rsx("id")&"|"
rsx.movenext :loop
rsx.close
sqlx="select id from Fl_News order by id desc"
set rsx=conn.execute(sqlx)
do while not rsx.eof
str_new=str_new&rsx("id")&"|"
rsx.movenext :loop
rsx.close
place=InStrRev(str,"|")
str=Left(str,place-1)
place=InStrRev(str_new,"|")
str_new=Left(str_new,place-1)
dim url,cwww,act
act=Trim(Request.QueryString("act"))
url =Request.ServerVariables("HTTP_HOST")
cwww="http://"+url
MakeHtm cwww&"/index.asp","../index.htm","首页写入成功!"
MakeHtm cwww&"/about.asp","../about.htm","企业简介写入成功!"
MakeHtm cwww&"/contact.asp","../contact.htm","联系我们写入成功!"
MakeHtm cwww&"/ry.asp","../ry.htm","资质荣誉写入成功!"
MakeHtm cwww&"/liuyan.asp","../liuyan.htm","联系我们写入成功!"
MakeHtm cwww&"/pro.asp","../pro.htm","产品展示写入成功!"
MakeHtm cwww&"/news.asp","../news.htm","生成车间写入成功!"
MakeHtm cwww&"/xinwen.asp","../xinwen.htm","新闻资讯写入成功!"
MakeHtm cwww&"/alliance.asp","../alliance.htm","销售网络写入成功!"
'生成产品
xstr=split(str,"|")
for i=0 to ubound(xstr)
MakeHtm cwww&"/uzProduct.asp?id="&xstr(i),"../uzProduct_"&xstr(i)&".htm","产品"&xstr(i)&"写入成功!"
next
xstr=split(str_new,"|")
for i=1 to ubound(xstr)/25+1
MakeHtm cwww&"/xinwen.asp?Page="&i,"../xinwen_"&i&".htm","新闻列表"&i&"写入成功!"
next
xstr=split(str_new,"|")
for i=0 to ubound(xstr)
MakeHtm cwww&"/uzNews.asp?id="&xstr(i),"../uzNews_"&xstr(i)&".htm","新闻"&xstr(i)&"写入成功!"
next
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Function MakeHtm(curl,turl,mess)
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
'把下面的地址替换成你的首页的文件地址,一定要用http://开头的绝对路径,不能写相对路径
xml.Open "GET", curl, False
xml.Send
BodyText=xml.ResponseBody
BodyText=BytesToBstr(BodyText,"gb2312")
Set xml = Nothing
'替换
BodyText=RegReplace(BodyText,"uzProduct\.asp\?id=(\d*)", "uzProduct_$1.htm")
BodyText=RegReplace(BodyText,"uzNews\.asp\?id=(\d*)", "uzNews_$1.htm")
BodyText=RegReplace(BodyText,"xinwen\.asp\?Page=(\d*)", "xinwen_$1.htm")
BodyText=replace(BodyText,"index.asp","index.htm")
BodyText=replace(BodyText,"about.asp","about.htm")
BodyText=replace(BodyText,"pro.asp","pro.htm")
BodyText=replace(BodyText,"news.asp","news.htm")
BodyText=replace(BodyText,"liuyan.asp","liuyan.htm")
BodyText=replace(BodyText,"ry.asp","ry.htm")
BodyText=replace(BodyText,"xinwen.asp","xinwen.htm")
BodyText=replace(BodyText,"contact.asp","contact.htm")
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile(server.MapPath(turl), True)
MyFile.WriteLine(BodyText)
MyFile.Close
response.Write mess
response.Write "<br>"
End Function
Public Function RegReplace(sContent, sPatrn, sNewStr)
Dim oTempReg : Set oTempReg = New RegExp
With oTempReg
.IgnoreCase = True
.Global = True
.Pattern = sPatrn
RegReplace = .Replace(sContent, sNewStr)
End With
Set oTempReg = Nothing
End Function
call CloseDatabase()
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
<style>
body,td{font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10.5pt;}
</style>
</head>
<body>
</body>
</html>
来自 iisboy
0
投稿
猜你喜欢
- union all在MySQL5.6下的表现Part1:MySQL5.6.25[root@HE1 ~]# MySQL -uroot -pEn
- 前言针对使用MySQL的索引,我们之前介绍过索引的最左前缀规则,索引覆盖,唯一索引和普通索引的使用以及优化器选择索引等概念,今天我们讨论下如
- 在我做过的N多项目中,基本都有个跑不开的怪圈——首页很难设计。根据进度安排,首页必须按时出来,不然没法review,也没法测试。于是,首页只
- 快速排序是C.R.A.Hoare于1962年提出的一种划分交换排序。它采用了一种分治的策略,通常称其为分治法(Divide-and-Conq
- 当需要从 JavaScript 中的数组中获取最后一个元素时,有多种选择,本文将提供 3 种可用方法。1. 数组 length 属性??le
- 树形目录显示程序问题描述:在我们项目中常常会出现自关联的数据表,如果我们从整体看去,整个表就呈现为一个树形数据结构(对于复杂的情况,它可能变
- 创建视图创建视图success.blade.php<!doctype html><html lang="{{ s
- 一、实现过程终端的字符颜色是用转义序列控制的,是文本模式下的系统显示功能,和具体的语言无关转义序列是以ESC开头,即用\033来完成(ESC
- 匹配文本并在其上一行追加文本问题描述Python匹配文本并在其上一行追加文本test.txtabcde1.读进列表后覆盖原文件 d
- 周五上班的主要任务是在公司老平台上用redis处理一个队列问题,顺便复习了一下redis操作的基础知识,回来后就想着在自己的博客demo里,
- Google网站管理员工具的验证方式有两种,一个是通过html文件,或一种是通过meta标签。通常情况下,这两个方式直接就可以通过验证了。但
- 假设在python中有一字典如下:x={‘a':'1,2,3', ‘b':'2,3,4'}需
- 1.基数排序基数排序的基本思想是先将数字按照个位数上数字的大小进行排序,排序之后再将已经排过序的数字再按照十位数上数字的大小进行排序,依次推
- 处理下拉列表需要使用selenium中的工具类Select,常用方法如下:示例网站:http://sahitest.com/demo示例场景
- 核心代码:#!/usr/bin/python#Filename:friendbook.pyimport cPickle as pimport
- SQL Server在删除数据后,会重新利用这部分空间,所以如果不是空间紧张的情况下,可以不回收。回收一般先回收日志文件,因为这个回收速度非
- 本来想把之前对artTemplate源码解析的注释放上来分享下,不过隔了一年,找不到了,只好把当时分析模板引擎原理后,自己尝试写下的模板引擎
- 一、http协议无状态问题http协议没有提供多次请求之间的关联功能,协议的本意也并未考虑到多次请求之间的状态维持,每一次请求都被协议认为是
- QPS原理:每天80%的访问集中在20%的时间里,这20%时间叫做峰值时间。公式:( 总PV数 * 80% ) / ( 每天秒数 * 20%
- 本文实例讲述了JS仿Windows开机启动Loading进度条的方法。分享给大家供大家参考。具体实现方法如下:<html><