asp 동적 웹 페이지 에서 정적 웹 페이지 로 전환 하 는 실현 코드

구체 적 인 코드 구현:1.템 플 릿 파일(html)
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>{title} - - </title>
<meta name="keywords" content="{metak}, 、 、 、 、 、 、 、 、 " />
<meta name="description" content="{metad},( ) 、 、 、 、 , 。 。" />
<link href="/css/style_new.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div><span class="font_white"></span></div>
<!-- top -->
<div><span class="font_white"></span></div>
<!-- top -->
<div id="top">
<div class="left"></div>
<div class="right">
<div class="topuser">
<form class="formbox" action="login_click.asp" method="post" name="loginform" id="loginform" onSubmit="return checkform2()">
<div style="line-height: 22px;height: 22px;"> :
<input name="uname" type="text" class="bot" id="uname" size="10" maxlength="10" /> :
<input name="pwd" type="password" class="bot" id="pwd" size="10" maxlength="18"/><label></label>
<input type="submit" name="Submit" value=" " /> <INPUT onClick="Javascript:window.location='/reg.asp';" type=button value=" " name=Submit2></div>
</form>
</div>
<div class="bottomuser"><a href="/index.asp"> </a> | <a href="/info_qiyejianjie.asp"> </a> | <a href="/class/"> </a> | <a href="/news_xinwenzhongxin.asp"> </a> | <a href="/info_jiamengzhengce.asp"> </a> | <a href="/info_kaiyedali.asp"> </a> | <a href="/info_zhuangxiufangan.asp"> </a> | <a href="/info_xingxiangzhanshi.asp"> </a> | <a href="/info_jiamengliucheng.asp"> </a> | <a href="/info_touziwenda.asp"> </a> | <a href="/zaixianliuyan.asp"> </a></div>
</div>
</div>
<!-- top -->
<!-- ad -->
<div id="subject01"><a href="/info_jiamengzhengce.asp" target="_blank"><img src="/images/pic_948x160.jpg" alt=" " width="948" height="218" border="0" /></a></div>
<!-- ad -->
<div class="clear"></div>
<!-- top -->
<!-- ad -->
<!-- ad -->
<div class="clear"></div>
<!-- -->
<div id="main">
<!-- -->
<div class="left">
<div class="top" style="background:url(/images/fenlei_12_07.jpg);"></div>
<div class="middle">
<ul>
<script language="javascript" src="../../class.js"></script>
<li class="middle02"></li>
<li class="middle03"> :4006-888048<br>
<strong> :</strong><br>
:0579-89960888 <br />
:0579-85210995 <br>
<strong> :</strong><br>
:00852-36458129 <br>
:00852-36458092 </li>
<li class="middle04"></li>
</ul>
</div>
<div class="bottom"></div>
<div class="leftnews"></div>
</div>
<!-- -->
<div class="right">
<div class="righttop"></div>
<div class="rightmiddle">
<ul>
<li class="04"><table width="700" border="0" cellpadding="0" cellspacing="0" background="/images/title.jpg">
<tr>
<td width="104" height="32" align="center"><h1 style="color:#FFFFFF; font-size:14px; font-weight:bold; margin:0 auto; padding:0px;" > </h1></td>
<td width="596" align="right"> :<a href="/index.asp"> </a> - </td>
</tr>
</table>
<li class="02">
<h1 style="margin:10px; padding:2px; font-size:18px; text-align:center;">{title}</h1>
</li>
<li class="02" style="text-align:left;">{demo}</li>
</li>
</ul>
</div>
<div class="rightbottom"></div>
</div>
</div>
<!-- -->
<div class="clear"></div>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="/css/style_new.css" rel="stylesheet" type="text/css" />
<div class="clear"></div>
<!-- footer -->
<table cellspacing="0" cellpadding="0" width="948" align="center" border="0">
<tbody>
<tr>
<td valign="center" align="middle" width="79"><a href="/info_lianxiwomen.asp"><img height="66" alt=" " src="/images/paizi_03.jpg" width="69" border="0" /></a></td>
<td width="869"><span class="font_space01"><a href="/info_qiyejianjie.asp"> </a> │ <a href="/info_jiamengzhengce.asp"> </a> | <a href="/info_zhuangxiufangan.asp"> </a> | <a href="/info_jiamengyoushi.asp"> </a> | <a href="/class/"> </a>│<a href="/zaixianliuyan.asp"> </a>│<a href="/info_lianxiwomen.asp"> </a>│<a href="sitemap.html" target="_blank"> </a></span><br />
: 123 8 ( )  :0579-89960888 :4006-888048 <br />
</td>
</tr>
</tbody>
</table>
<!-- footer -->
<span style="visibility: hidden;"><a href="http://www.51aiyaya.com" target="_blank"><strong> </strong></a>
<a href="http://www.51aiyaya.com" target="_blank"> </a>
<a href="http://www.51aiyaya.com" target="_blank"> </a> <script src="http://s23.cnzz.com/stat.php?id=1117055&web_id=1117055" language="JavaScript" charset="gb2312"></script></span>
</body>
</html>
처 리 된 파일(asp)
 
<!--#include file="conn.asp"-->
<%Server.ScriptTimeOut=99999999%>
<%
dim action,id,news
Layout="news"
id=request.QueryString("id")
action=request.QueryString("action")
select case action
case "add"
%>
<%
' html
case "htmlall"
set rs=server.CreateObject("adodb.recordset")
Sql = "Select id from news order by id"
rs.open sql,conn,1,1
do while not rs.eof
FsoFile "news",rs("id")
response.write"<div style='color:#003333;' align='center'>"&rs("id")&" HTML !</div>"
rs.movenext
loop
rs.close
response.write"<div style='color:#FF0000;' align='center'> HTML !</div></br>"
end select
%>
<%
' html
Function FsoFile(Layout,ID)
Dim Fso,FilePath,FsoF,FsoH,FsoRs,CreateFilePath
FSOCreateDIR "..
ews\" & ID & ""
CreateFilePath = "..
ews\" & ID & "" 'HTML
FilePath=Server.Mappath(CreateFilePath) & "\index.html" ' html
Set Fso=Server.CreateObject("Scripting.FileSystemObject")
Set FsoH=Fso.OpenTextFile(Server.Mappath("..\templates
ews_show.html"),1,true) '
Content = FsoH.ReadAll
Set FsoRs = Conn.Execute("select * from news where id="&id)
title=FsoRs("title")
demo=FsoRs("demo")
Content = Replace(Content,"{id}",FsoRs("id"))
Content = Replace(Content,"{title}",FsoRs("title"))
Content = Replace(Content,"{demo}",FsoRs("demo"))
Content = Replace(Content,"{webname}",webname)
Content = Replace(Content,"{icp}",icp)
Content = Replace(Content,"{dianhua}",dianhua)
Content = Replace(Content,"{dizhi}",dizhi)
Content = Replace(Content,"{qq}",qq)
Content = Replace(Content,"{alibaba}",alibaba)
Content = Replace(Content,"{tongji}",tongji)
FsoRs.Close
Set FsoRs=Nothing
set stm = server.createobject("ADODB.Stream")
stm.Charset = "gb2312" '
stm.Open
stm.WriteText content
stm.SaveToFile FilePath, 2
set stm = nothing
End Function
%>
<%
function FSOCreateDIR(LocalPath)
dim patharr,path_level,i,pathtmp,cpath,CreateDIR,FileObject
on error resume next
LocalPath = Server.MapPath(LocalPath)
LocalPath = replace(LocalPath,"\","/")
set FileObject = server.createobject("Scripting.FileSystemObject")
patharr = split(LocalPath,"/")
path_level = ubound(patharr)
for i = 0 to path_level
if i=0 then pathtmp = patharr(0) & "/" else pathtmp = pathtmp & patharr(i) & "/"
cpath = left(pathtmp,len(pathtmp)-1)
if not FileObject.FolderExists(cpath) then FileObject.CreateFolder(cpath)
next
set FileObject = nothing
if err.number<>0 then
CreateDIR = false
err.Clear
else
CreateDIR = true
end if
end function
%>
배경 에 정적 뉴스 링크 를 추가 합 니 다

<TD height=20 align="center"><a href="../admin_product/saveaddnews.asp?action=htmlall" target="ggdlab"> </a></TD>
제 블 로그 에서 유래 합 니 다.http://blog.csdn.net/lingfeng179

좋은 웹페이지 즐겨찾기