<%
'生成新闻详细静态方法
Function html_To_News(ID, bkkey)
	Call SiteInfo()'读取网站基本信息

	Set rs = server.CreateObject("adodb.recordset")
	rs.open "select * from BokeCMS_News where ID="&ID, Conn, 1, 2
	NewsName = rs("NewsName")
	ClassSeo = rs("ClassSeo")
	Origin = rs("Origin")
	author = rs("author")
	Text = rs("Text")
	Color = rs("Color")
	Bold = rs("Bold")
	SmallPic = rs("SmallPic")	
	AddTime = rs("AddTime")
	UpdateTime = rs("UpdateTime")
	Content = rs("Content")
	
	SortID = rs("SortID")
	SortName = Conn.execute("select * from BokeCMS_NewsSort where ID="&rs("SortID"))("SortName")	
	SeoTitle = rs("NewsName")
	If rs("SeoKeywords") <> "" Then
		SeoKeywords = rs("SeoKeywords")
	Else
		SeoKeywords = rs("NewsName")
	End If
	If rs("SeoDescription") <> "" Then
		SeoDescription = rs("SeoDescription")
	Else
		SeoDescription = rs("NewsName")
	End If
	rs.close : set rs = nothing
	If bkkey = "PC" Then Flag = "ViewFlag"
	If bkkey = "Mobile" Then Flag = "MobileFlag"

	set rs = server.CreateObject("adodb.recordset")
	rs.open "select top 1 * from BokeCMS_News where ID<" & ID & " and "&Flag&" Order by ID desc", Conn, 1, 2
	if rs.eof then
		PrevLink = "#" : PrevName = "暂无"
	else
		PrevLink = rs("ClassSeo") & Separated & rs("ID") & "." & HTMLName : PrevName = rs("NewsName")
	end if
	rs.close
	rs.open "select top 1 * from BokeCMS_News where ID>" & ID & " and "&Flag&" Order by ID asc", Conn, 1, 2
	if rs.eof then
		NextLink = "#" : NextName = "暂无"
	else
		NextLink = rs("ClassSeo") & Separated & rs("ID") & "." & HTMLName : NextName = rs("NewsName")
	end if
	rs.close : set rs = nothing

	If bkkey = "PC" Then
		replace_code = ReadFromUTF(TemplatePath&"/html/NewsView.html","utf-8")'读取模板文件，并发送请求编码到SC_config.asp
		FilePath = "/"&NewsDir&"/"&ClassSeo&Separated&ID&"."&HTMLName&""'获取将要生成的文件路径和名
		TemplatePath = TemplatePath
	End If
	If bkkey = "Mobile" Then
		replace_code = ReadFromUTF(mTemplatePath&"/html/NewsView.html","utf-8")'读取模板文件，并发送请求编码到SC_config.asp
		FilePath = "/wap/"&NewsDir&"/"&ClassSeo&Separated&ID&"."&HTMLName&""'获取将要生成的文件路径和名
		TemplatePath = mTemplatePath
	End If

	If SiteStatus Then'如果网站开启就替换模板中标签
		replace_code = Position(replace_code, SortID, 2, bkkey)

		replace_code = replace(replace_code, "{bokecms:SortName}", SortName)
		replace_code = ReplaceCommon(replace_code, TemplatePath, bkkey)

		replace_code = replace(replace_code, "{bokecms:ID}", ID)
		replace_code = replace(replace_code, "{bokecms:NewsName}", NewsName)
		replace_code = replace(replace_code, "{bokecms:Origin}", Origin)
		replace_code = replace(replace_code, "{bokecms:author}", author)
		replace_code = replace(replace_code, "{bokecms:Text}", Text)
		replace_code = replace(replace_code, "{bokecms:Color}", Color)
		replace_code = replace(replace_code, "{bokecms:Bold}", Bold)
		replace_code = replace(replace_code, "{bokecms:SmallPic}", SmallPic)
		replace_code = replace(replace_code, "{bokecms:SortID}", SortID)
		replace_code = replace(replace_code, "{bokecms:Content}", Content)		
		replace_code = replace(replace_code, "{bokecms:SeoTitle}", SeoTitle)
		replace_code = replace(replace_code, "{bokecms:SeoKeywords}", SeoKeywords)
		replace_code = replace(replace_code, "{bokecms:SeoDescription}", SeoDescription)
		replace_code = ParseTime(replace_code, AddTime, "AddTime")'对时间进行格式化
		replace_code = ParseTime(replace_code, UpdateTime, "UpdateTime")'对时间进行格式化
		replace_code = replace(replace_code, "{bokecms:PrevName}", PrevName)
		replace_code = replace(replace_code, "{bokecms:PrevLink}", PrevLink)
		replace_code = replace(replace_code, "{bokecms:NextName}", NextName)
		replace_code = replace(replace_code, "{bokecms:NextLink}", NextLink)

		replace_code = HtmlTo(replace_code, "", "", bkkey, "")
	Else
		replace_code = ExplainJS'否则生成暂停网站通告内容
	End If
	
	If bkkey = "PC" Then replace_code = replace_code & ConstJs
	Call WriteToUTF(FilePath, replace_code)'将要生成文件和路径、名、编码后的内容请求生成静态文件SC_config.asp	
End Function
%>