<%
server.scripttimeout = 999
Call SiteInfo()

Function ReadFromUTF(FilePath,CharSet) 'FilePath为要读取的模版文件路径和名；Charset是编码类型，对模板文件进行编码
	Set fso = Server.CreateObject("Scripting.FileSystemObject")
	if fso.FileExists(server.MapPath(FilePath)) then
		Dim str
		Set stm = server.CreateObject("adodb.stream")
		stm.Type = 2
		stm.Mode = 3
		stm.Charset = CharSet
		stm.Open
		stm.loadfromfile Server.MapPath(FilePath)
		str = stm.readtext
		stm.Close
		Set stm = Nothing
		ReadFromUTF = str
	Else
		ReadFromUTF = ""
	end if
End Function

Function WriteToUTF(FilePath, Content)'FilePath为要生成的文件路径和名；Content是经编码替换标签后的内容
Set objStream=Server.CreateObject("ADODB.Stream")
With objStream
	.Open
	.Charset="utf-8"
	.Position=objStream.Size
	.WriteText=Content
	.SaveToFile server.mappath(FilePath),2'正式生成静态文件
	.Close
End With
Set objStream=Nothing
End Function


'生成模板方法
Function html_Template(FileName,Content,bkkey)	
	FolderName = FileName
	Template = FileName&".html"
	If FileName="Css" And bkkey = "PC" Then'生成PC CSS
    FilePath = ""&TemplatePath&"/css/"&FileName&".css"
	ElseIf FileName="Css" And bkkey = "Wap" Then'生成WAP CSS
    FilePath = ""&mTemplatePath&"/css/"&FileName&".css"
	else
	If bkkey = "PC" Then'生成PC模板	
		FilePath = TemplatePath&"/html/"&Template	
	elseIf bkkey = "Wap" Then'生成WAP模板			
		FilePath = mTemplatePath&"/html/"&Template
	End If
	End If
	Call WriteToUTF(FilePath,Content)
End Function%>