一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術(shù)|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務(wù)器之家 - 編程語言 - ASP教程 - asp 由動態(tài)網(wǎng)頁轉(zhuǎn)變?yōu)殪o態(tài)網(wǎng)頁的實現(xiàn)代碼

asp 由動態(tài)網(wǎng)頁轉(zhuǎn)變?yōu)殪o態(tài)網(wǎng)頁的實現(xiàn)代碼

2019-09-10 11:00asp開發(fā)網(wǎng) ASP教程

在asp中實現(xiàn)由動態(tài)網(wǎng)頁轉(zhuǎn)變?yōu)殪o態(tài)網(wǎng)頁可以使用模板生成,通過FsoFile進行操作根據(jù)模板生成靜態(tài)網(wǎng)頁,比較適合產(chǎn)品和新聞兩個板塊轉(zhuǎn)變!

具體代碼實現(xiàn): 
1.模板文件(html) 

復(fù)制代碼代碼如下:


<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},(香港)哎呀呀飾品國際集團有限公司是一家經(jīng)營飾品、日用品、化妝品、文具、玩具等為一體的公司,下設(shè)加工廠和連鎖店兩個利潤中心。香港哎呀呀飾品公司歡迎您愛呀呀飾品加盟連鎖店。" /> 
<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">企業(yè)簡介</a> | <a href="/class/">產(chǎn)品展示</a> | <a href="/news_xinwenzhongxin.asp">新聞中心</a> | <a href="/info_jiamengzhengce.asp">經(jīng)銷政策</a> | <a href="/info_kaiyedali.asp">開業(yè)大禮</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結(jié)束 --> 
<!-- ad開始 --> 
<div id="subject01"><a href="/info_jiamengzhengce.asp" target="_blank"><img src="/images/pic_948x160.jpg" /> 2.處理的文件(asp) 

復(fù)制代碼代碼如下:


<!--#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 "..\news\" & ID & "" 
CreateFilePath = "..\news\" & ID & "" 'HTML所在文件夾 
FilePath=Server.Mappath(CreateFilePath) & "\index.html" '定義生成html文件名 
Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
Set FsoH=Fso.OpenTextFile(Server.Mappath("..\templates\news_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 
%> 


3.在后臺添加生成靜態(tài)新聞鏈接 

復(fù)制代碼代碼如下:


<TD height=20 align="center"><a href="../admin_product/saveaddnews.asp?action=htmlall" target="ggdlab">生成新聞靜態(tài)</a></TD> 


來源于我的博客 
http://blog.csdn.net/lingfeng179

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 四虎音影 | 日韩高清一区二区三区不卡 | 99精品国产久热在线观看66 | 嫩草影院精品视频在线观看 | 农夫69小说恋老妇小说 | 性xxxx直播放免费 | 免费观看美女被cao视频 | 国产美女久久精品香蕉69 | 亚洲剧情在线观看 | 白丝萝莉h | 欧美同性猛男野外gay免费 | 日韩在线视频免费观看 | www.87福利| 久久久久久久99精品免费观看 | 皇上撞着太子妃的秘密小说 | 国产亚洲精品日韩香蕉网 | 国产精品嫩草影院一二三区 | 国产91页 | 亚洲精品一二三四 | 国产农村一一级特黄毛片 | 继攵催眠女乱h调教 | 深夜在线小视频 | 国产精品欧美亚洲韩国日本99 | dyav午夜片| 兽皇videos日本另类 | 九九99热久久999精品 | 嫩草蜜桃| 免费理伦片手机在线播放 | 四虎影院在线免费观看 | 久久这里只有精品国产精品99 | 日本漫画工囗全彩内番e绅 日本伦理动漫在线观看 | 日韩欧美推理片免费看完整版 | 国产91精品久久久久久久 | 公交车揉捏大乳呻吟喘娇 | 6080窝窝理论 | hd性欧美俱乐部中文 | 天天综合天天色 | 国产一卡2卡3卡4卡公司科普 | 粗了大了 整进去好爽视频 刺激一区仑乱 | 14一18cad中国大学生 | 亚洲欧美日韩国产精品影院 |