html静态页面的制作,漂亮的html静态页面

冯敏学

原理:通过浏览器传送变量,如

http://127.0.0.1/shengcheng.asp?id=90代码:if SaveFile(/new/id.html,http://127.0.0.1/news.asp?id=id) then 中/newid.html,是你生成的文件和路径。

http://127.0.0.1/news.asp?id=id是asp的路径大家可以自己设置修改,其中 id 是读取浏览器的变量。

网址改成你自己的。

使用方法,给你的文章列表添加一个连接,如 http://127.0.0.1/shengcheng.asp?id=9090这个变量相信大家会调用吧,这样就能在/new目录下生成按照id排列的html文章了shengcheng.asp文件如下:% Dimid id=Request(id) % % ifSaveFile(/new/id.html,http://127.0.0.1/news.asp?id=id)then Response.write已生成 else Response.write没有生成 endif functionSaveFile(LocalFileName,RemoteFileUrl) DimAds,Retrieval,GetRemoteData OnErrorResumeNext SetRetrieval=Server.CreateObject(Microsoft.XMLHTTP)'//把单词拆开防止杀毒软件误杀 WithRetrieval .OpenGet,RemoteFileUrl,False,, .Send GetRemoteData=.ResponseBody EndWith SetRetrieval=Nothing SetAds=Server.CreateObject(Adodb.Stream)'//把单词拆开防止杀毒软件误杀 WithAds .Type=1 .Open .WriteGetRemoteData .SaveToFileServer.MapPath(LocalFileName),2 .Cancel() .Close() EndWith SetAds=nothing iferr0then SaveFile=false err.clear else SaveFile=true endif Endfunction %随着网站访问量的加大,每次从数据库读取都是以效率作为代价的,很多用ACCESS作数据库的更会深有体会,静态页加在搜索时,也会被优先考虑。

互联网上流行的做法是将数据源代码写入数据库再从数据库读取生成静态面,这样无形间就加大了数据库。

将现有的ASP页直接生成静态页,将会节省很多。