<%
'生成企业栏目页静态方法
dim SortID
Function html_To_ApageSort(ID, Ke01)
	dim newHtml
	set newHtml = new Html

	SortID = ID
	Call SiteInfo()
	set rs = server.CreateObject("adodb.recordset")
	rs.open "select * from keyicms_ApageSort where ID=" & ID, conn, 1, 2
	SortName = rs("SortName")
	SeoTitle = rs("SortName")
	If rs("SeoKeywords") <> "" Then
		SeoKeywords = rs("SeoKeywords")
	Else
		SeoKeywords = SeoTitle
	End If
	If rs("SeoDescription") <> "" Then
		SeoDescription = rs("SeoDescription")
	Else
		SeoDescription = SeoTitle
	End If
	TemplateIndex = rs("TemplateIndex")
	TemplateView = rs("TemplateView")
	mTemplateIndex = rs("TemplateIndex")
	mTemplateView = rs("mTemplateView")
	FolderName = rs("FolderName")

	Call CheckFolder(FolderName)
	rs.close : set rs = nothing

	'==============================================
	Set rs = server.CreateObject("adodb.recordset")
	rs.open "select * from keyicms_Apage where ViewFlag and SortID=" & ID & " Order by Sequence Asc", conn, 1, 2
	If rs.eof Then
		ApageID = 0
	Else
		ApageName = rs("ApageName")
		Content = rs("Content")
		AddTime = rs("AddTime")
		UpdateTime = rs("UpdateTime")
		ApageID = rs("ID")
	End If
	rs.close : set rs = nothing

	set rs = server.CreateObject("adodb.recordset")
	rs.open "select top 1 * from keyicms_Apage where ViewFlag and SortID=" & ID & " and ID<" & ApageID & " Order by ID Desc", Conn, 1, 2
	if rs.eof then
		PrevLink = "#" : PrevName = "暂无"
	else
		PrevLink = rs("ClassSeo") & Separated & rs("ID") & "." & HTMLName : PrevName = rs("ApageName")
	end if
	rs.close
	rs.open "select top 1 * from keyicms_Apage where ViewFlag and SortID=" & ID & " and ID>" & ApageID & " Order by ID Asc", Conn, 1, 2
	if rs.eof then
		NextLink = "#" : NextName = "暂无"
	else
		NextLink = rs("ClassSeo") & Separated & rs("ID") & "." & HTMLName : NextName = rs("ApageName")
	end if
	rs.close : set rs = nothing
	'==============================================

	If Ke01 = "PC" Then
		If Checkfile(TemplatePath & "/html/" & TemplateIndex) Then
			replace_code = ReadFromUTF(TemplatePath & "/html/" & TemplateIndex, "utf-8")
		Else
			replace_code = ReadFromUTF(TemplatePath & "/html/" & TemplateView,"utf-8")
		End If
		FilePath = "/" & FolderName & "/Index."&HTMLName
		TemplatePath = TemplatePath
	End If
	If Ke01 = "Mobile" Then
		If Checkfile(mTemplatePath & "/html/" & TemplateIndex) Then
			replace_code = ReadFromUTF(mTemplatePath & "/html/" & TemplateIndex,"utf-8")
		Else
			replace_code = ReadFromUTF(mTemplatePath & "/html/" & TemplateView,"utf-8")
		End If
		FilePath = "/m/" & FolderName & "/Index."&HTMLName
		TemplatePath = mTemplatePath
	End If

	If SiteStatus Then
		with newHtml
			.ReadFromUTF TemFilePath & "/" & TemplateView, "utf-8"
			.Include()
			.Position SortID, 1
			.ReplaceCommon()

			newHtml.replace_code = replace(newHtml.replace_code, "{keyicms:ID}", ID)
			newHtml.replace_code = replace(newHtml.replace_code, "{keyicms:ApageName}", ApageName)
			newHtml.replace_code = replace(newHtml.replace_code, "{keyicms:Content}", Content)
			
			newHtml.replace_code = replace(newHtml.replace_code, "{keyicms:SeoTitle}", SeoTitle)
			newHtml.replace_code = replace(newHtml.replace_code, "{keyicms:SeoKeywords}", SeoKeywords)
			newHtml.replace_code = replace(newHtml.replace_code, "{keyicms:SeoDescription}", SeoDescription)
	
			newHtml.replace_code = ParseTime(newHtml.replace_code, AddTime, "AddTime")
			newHtml.replace_code = ParseTime(newHtml.replace_code, UpdateTime, "UpdateTime")
	
			newHtml.replace_code = replace(newHtml.replace_code, "{keyicms:PrevName}", PrevName)
			newHtml.replace_code = replace(newHtml.replace_code, "{keyicms:PrevLink}", PrevLink)
			newHtml.replace_code = replace(newHtml.replace_code, "{keyicms:NextName}", NextName)
			newHtml.replace_code = replace(newHtml.replace_code, "{keyicms:NextLink}", NextLink)

			.KE01_If()

			If Ke01 = "PC" Then newHtml.replace_code = newHtml.replace_code & ConstJs
		end with
	Else
		newHtml.replace_code = ExplainJS
	End If
	newHtml.WriteToUTF(FilePath)
	set newHtml = nothing
End Function
%>