性爱视频在线播放-人人射人人射-99热网-极品探花在线|www.kangbangglove.com

ASP生成html的方法

文章詳情

現(xiàn)在已經(jīng)有很多生成html的新聞系統(tǒng),但是都是用的模板,本函數(shù)實(shí)現(xiàn)把a(bǔ)sp頁(yè)面產(chǎn)生的html代碼保存成為一個(gè)html文件,這樣就沒(méi)有必要改動(dòng)原來(lái)的頁(yè)面就可以輕松完成一個(gè)生成html的新聞系統(tǒng)了。下面是山東網(wǎng)站建設(shè)專家-山東織夢(mèng)無(wú)憂提供的代碼:

<%
‘當(dāng)目標(biāo)頁(yè)面的包含文件即#include的頁(yè)面里邊存在response.End()的時(shí)候本程序有問(wèn)題
‘注意:本文件一定要放在20041227111723.htm指向的文件的同一目錄下
dim hughchiu_rtcode
Function get_exe_code(20041227111723.htm)
dim execode
dim tmp_str
Dim re,re1,content,fso,f,aspStart,aspEnd
dim ms,m
execode = “”
set fso=CreateObject(“Scripting.FileSystemObject”)
set f=fso.OpenTextFile(server.mappath(20041227111723.htm))
content=f.ReadAll
f.close
set f=nothing
set fso=nothing

set re = new regexp
re.ignorecase = true
re.global = true
re.pattern = “<%@[^%]+%>”
content = re.replace(content,”")

re.global = false
re.pattern = “
do
set ms = re.execute(content)
if ms.count<>0 then
set m = ms(0)
tmp_str = get_exe_code(m.submatches(0))
content = re.replace(content, tmp_str)
else
exit do
end if
loop
set m = nothing
set ms = nothing

re.pattern=”^s*=”
aspEnd=1
aspStart=inStr(aspEnd,content,”<%”)+2

set re1=new RegExp
re1.ignorecase = true
re1.global = false
re1.pattern = “response.Write(.+)”

do while aspStart>aspEnd+1
execode = execode&vbcrlf&” hughchiu_rtcode = hughchiu_rtcode&”"”&replace( replace(Mid(content,aspEnd,aspStart-aspEnd-2),”"”",”"”"”"), vbcrlf, “”"&vbcrlf&”"”)&”"”"&vbcrlf
aspEnd=inStr(aspStart,content,”%>”)+2
tmp_str = Mid(content,aspStart,aspEnd-aspStart-2)

do
set ms = re1.execute(tmp_str)
if ms.count<>0 then
set m = ms(0)
tmp_str = re1.replace(tmp_str, ” hughchiu_rtcode = hughchiu_rtcode&”&m.submatches(0))
else
exit do
end if
loop

set m = nothing
set ms = nothing

execode = execode& re.replace(tmp_str,”hughchiu_rtcode = hughchiu_rtcode&”)

aspStart=inStr(aspEnd,content,”<%”)+2
loop

set re1 = nothing
set re=nothing

execode = execode&vbcrlf&” hughchiu_rtcode = hughchiu_rtcode&”"”&replace( replace(Mid(content,aspEnd), “”"”, “”"”"”), vbcrlf, “”"&vbcrlf&”"” )&”"”"&vbcrlf
get_exe_code = “<%”&execode&”%>”
End Function

function asp2html(20041227111723.htm)
dim code
code = replace( replace( replace( get_exe_code(20041227111723.htm), “hughchiu_rtcode = hughchiu_rtcode&”"”"”&vbcrlf, “” ), “<%”, “” ), “%>”, “” )
‘response.Write(code)
execute(code)
‘response.Write( hughchiu_rtcode )
asp2html = hughchiu_rtcode
end function
%>

使用范例:
  set fso=CreateObject(“Scripting.FileSystemObject”)
  set f=fso.CreateTextFile( server.mappath( “youpage.htm” ), true )
  f.WriteLine( asp2html(“youpage.asp”) )
  f.close
  set f = nothing
  set fso = nothing

 

收藏:0
來(lái)源:網(wǎng)站建設(shè)網(wǎng)

版權(quán):所有文章為演示數(shù)據(jù),版權(quán)歸原作者所有,僅提供演示效果!

轉(zhuǎn)載請(qǐng)注明出處:http://www.kangbangglove.com/wzjs/5636.html

相關(guān)推薦
企業(yè)網(wǎng)站建設(shè)應(yīng)該重視欄目結(jié)構(gòu)
======================山東織夢(mèng)無(wú)憂 先建設(shè)網(wǎng)站后付款===========================網(wǎng)站欄目結(jié)構(gòu)與導(dǎo)航奠定了網(wǎng)站的基本框架,決定了用戶是否可以通過(guò)網(wǎng)站方便地獲取信息,也決定了搜索引擎是否可以順利地為網(wǎng)站的每個(gè)網(wǎng)頁(yè)建立索引...
2024-02-25
78
四代網(wǎng)站建設(shè)-營(yíng)銷型網(wǎng)站建設(shè)
網(wǎng)站建設(shè)主要經(jīng)歷了四個(gè)階段: 1、文字內(nèi)容階段:完全手工編輯,技術(shù)難度大,制作粗糙。 2、圖文階段:增加了動(dòng)畫文件,展示上更加形象,但無(wú)互動(dòng)性。 3、互動(dòng)階段:前臺(tái)圖文并茂,后臺(tái)數(shù)據(jù)庫(kù)管理,但生成的是動(dòng)態(tài)的網(wǎng)頁(yè),營(yíng)銷性差。 4、營(yíng)銷階段:后臺(tái)功能強(qiáng)大,模板多樣,生成...
2024-02-25
57
企業(yè)網(wǎng)站如何才能發(fā)揮作用?
企業(yè)網(wǎng)站如何才能發(fā)揮作用,山東網(wǎng)站建設(shè)工作室織夢(mèng)無(wú)憂專業(yè)為您說(shuō)明一下: 網(wǎng)站是企業(yè)信息化建設(shè)的重要組成部分,越來(lái)越多的企業(yè)擁有了自己的企業(yè)網(wǎng)站,一方面目的是樹(shù)立企業(yè)形象,另一方面也希望通過(guò)這個(gè)網(wǎng)絡(luò)平臺(tái)帶來(lái)更多銷售利益。然而有很多網(wǎng)站因 為無(wú)法有很好的排名,從而在網(wǎng)絡(luò)...
2024-02-25
71
網(wǎng)站建設(shè)光有程序員還遠(yuǎn)遠(yuǎn)不夠
網(wǎng)站是網(wǎng)絡(luò)營(yíng)銷的一個(gè)綜合性工具,通過(guò)網(wǎng)站可以達(dá)到營(yíng)銷信息的有效傳播、顧客服務(wù)、銷售促進(jìn)等功能。要通過(guò)良好的搜索引擎可見(jiàn)性、良好的用戶體驗(yàn)實(shí)現(xiàn)網(wǎng)站的功能應(yīng)該怎樣策劃建設(shè)網(wǎng)站呢? 今天跟朋友聊天的過(guò)程中,朋友說(shuō)到網(wǎng)站建設(shè)交給編程員就可以啦。這種觀點(diǎn)是比較偏激,...
2024-02-25
100
發(fā)表評(píng)論