<!--#include file="utf-8.asp"-->
<!--#include file="seeion.asp"-->
<!--#include file="../module/news.asp"-->

<%
Template="../template/ShowNews.htm" '模版
str=ReadFromUTF(Template,"utf-8") '编码
content=Replace(str,"{Kdesign_webtitle}",Kdesign_webtitle) '替换
content=Replace(content,"{Kdesign_title}",Kdesign_title)
content=Replace(content,"{Kdesign_keyword}",Kdesign_keyword)
content=Replace(content,"{Kdesign_description}",Kdesign_description)
content=Replace(content,"{Kdesign_logo}",Kdesign_logo)
content=Replace(content,"{Kdesign_enurl}",Kdesign_enurl)
content=Replace(content,"{Kdesign_cnurl}",Kdesign_cnurl)
content=Replace(content,"{Kdesign_newstitle}",Kdesign_newstitle)
content=Replace(content,"{Kdesign_data}",Kdesign_data)
content=Replace(content,"{id}",id)
content=Replace(content,"{Kdesign_body}",Kdesign_body)
content=Replace(content,"{Kdesign_prev}",Kdesign_prev)
content=Replace(content,"{Kdesign_next}",Kdesign_next)
content=Replace(content,"{Kdesign_copyright}",Kdesign_copyright)
content=Replace(content,"{Kdesign_share}",Kdesign_share)
content=Replace(content,"{Kdesign_beian}",Kdesign_beian)
content=Replace(content,"{Kdesign_dz}",Kdesign_dz)
content=Replace(content,"{Kdesign_tel}",Kdesign_tel)
content=Replace(content,"{Kdesign_fax}",Kdesign_fax)
content=Replace(content,"{Kdesign_email}",Kdesign_email)
content=Replace(content,"{Kdesign_nav}",Kdesign_nav)
content=Replace(content,"{Kdesign_leftnav}",Kdesign_leftnav)
content=Replace(content,"{Kdesign_hot}",Kdesign_hot)
content=Replace(content,"{Kdesign_flink}",Kdesign_flink)
content=Replace(content,"{eqq}",eqq)
content=Replace(content,"{root}",root)


Filen="../News/"&id&".html" '静态存放位置
Call WriteToUTF(content,Filen) '生成静态页
If Not Err Then Response.Write "<a href='"&root&"/News/"&id&".html' target='_blank'>News/"&id&".html</a>...生成成功！</br>"

Function ReadFromUTF(TempString,CharSet) '路径；编码
Dim str
Set stm=server.CreateObject("adodb.stream")
stm.Type=2
stm.Mode=3
stm.Charset=CharSet
stm.Open
stm.loadfromfile Server.MapPath(TempString)
str=stm.readtext
stm.Close
Set stm=Nothing
ReadFromUTF=str
End Function

Function WriteToUTF(content,Filen) '将替换后的内容写入HTML文档,content为替换后的字符串,Filen为生成的文件名
Set objStream=Server.CreateObject("ADODB.Stream")
    With objStream
    .Open
    .Charset="utf-8" '编码，这里你可以改成任何编码
    .Position=objStream.Size
    .WriteText=content '模版+数据 写入内容
    .SaveToFile server.mappath(Filen),2 '生成文件路径
    .Close
    End With
Set objStream=Nothing
End Function
%>

