<!--#include file="../../ACT.Function.asp"-->
<!--#include file="../../../act_inc/ACT.Code.asp"-->
<% 
	If Not ACTCMS.ACTCMS_QXYZ(0,"dyxt_ACT","") Then   Call Actcms.Alert("对不起，你没有操作权限！","") 
	Dim MakeIndex,TemplateContent,ID,Rs,DiyPath,filename
	Set MakeIndex =New ACT_Code

	ID=ACTCMS.ChkNumeric(request.QueryString("ID"))
	Set Rs=ACTCMS.ACTEXE("Select * From DiyPage_ACT where id="&id&"")
	If rs.eof Then response.write "错误":response.end
	Application(AcTCMSN & "ACTCMS_TCJ_Type")= "OTHER"
	Application(AcTCMSN & "ACTCMSTCJ")=rs("pagename")

	Application(AcTCMSN & "ACTCMS_TCJ_Type") = "OTHER"
	If Right(rs("DiyPath"),1)<>"/" Then 
		DiyPath=ACTCMS.ActSys&rs("DiyPath")&"/"
	Else
		DiyPath=ACTCMS.ActSys&rs("DiyPath")
	End If 
	Call Actcms.CreateFolder(DiyPath)
	FileName=Replace(rs("FileName"), "/", "")
	If Trim(FileName)="" Then 
		FileName=DiyPath&"index.htm"
		Application(AcTCMSN & "link")=DiyPath
	Else
		FileName=DiyPath&FileName
		Application(AcTCMSN & "link")=FileName
	End If 
	If rs("tempurl")<>"" Then 
	TemplateContent = MakeIndex.LoadTemplate(rs("tempurl"))
	End If 
	IF TemplateContent <> "" Then
		TemplateContent = MakeIndex.LabelReplaceAll(TemplateContent)
	End If 
	If InStr(TemplateContent, "{$diycontent}") > 0   Then
		TemplateContent = Replace(TemplateContent, "{$diycontent}", rs("content"))
	End If 

	If InStr(TemplateContent, "{$pagename}") > 0  And  rs("pagename")<>""  Then
		TemplateContent = Replace(TemplateContent, "{$pagename}", rs("pagename"))
	Else
		TemplateContent = Replace(TemplateContent, "{$pagename}", "")
	End If 

	Call MakeIndex.FSOSaveFile(TemplateContent,FileName)	
	response.Write "<a  href=""" & FileName & """target=""_blank""" &  ">单页生成成功,点击浏览</a>"
	Set MakeIndex=Nothing:Set ACTCMS=Nothing
 %>