<!--#include file="../fy_inc/fy.User.asp"-->
 <% 
Dim ACT_L
Set ACT_L = New ACT_Code
Class Cls_Special
	Dim Reg
    Dim   ID,rs,sql,i,ModeID,DateForm,TitleLen,ContentLen,ListNumber,keywords,ClassID,Parameter,sqlstr,DiyContents
	Public TemplateContent
 	Private Sub Class_Initialize()
		Set Reg = New RegExp
		Reg.Ignorecase = True
		Reg.Global = True
	End Sub
	Function loads()	 
 	 ID = ChkNumeric(Request("ID"))
 	 if ID=0 or ID="" Then ID=1
  	 Application(fycmsN&"ModeID")=1
	 Set rs=fycms.actexe("select id,title,writer,pubdate,tempurl from Special_fy where id="&id)
	 If rs.eof Then echo "²خت‎´يخَ":response.end
 	 TemplateContent = LoadTemplate(rs("tempurl"))
 	 If InStr(TemplateContent, "{$Special_writer}") > 0 Then
		 TemplateContent = Replace(TemplateContent,"{$Special_writer}",Trim(rs("writer")))
	 Else
		 TemplateContent = Replace(TemplateContent,"{$Special_writer}","")
	 End If 
 	 If InStr(TemplateContent, "{$Special_pubdate}") > 0 Then
 		 TemplateContent = Replace(TemplateContent,"{$Special_pubdate}",rs("pubdate"))
	 Else
		 TemplateContent = Replace(TemplateContent,"{$Special_pubdate}","")
	 End If 

 	 If InStr(TemplateContent, "{$Special_title}") > 0 Then
 		 TemplateContent = Replace(TemplateContent,"{$Special_title}",rs("title"))
	 Else
		 TemplateContent = Replace(TemplateContent,"{$Special_title}","")
	 End If 

 
 	 If InStr(TemplateContent, "{$Special_Content}") > 0 Then
 		 TemplateContent = Replace(TemplateContent,"{$Special_Content}",rs("Content"))
	 Else
		 TemplateContent = Replace(TemplateContent,"{$Special_Content}","")
	 End If 

	 If InStr(TemplateContent, "{$ID}") > 0 Then
 		 TemplateContent = Replace(TemplateContent,"{$ID}",rs("ID"))
 	 End If 
   	 Set rs=fycms.actexe("select id,notename,arcid,ModeID,DiyContent,DateForm,TitleLen,ContentLen,ListNumber,isauto,keywords,ClassID from Node_fy where sid=0 or  sid="&id)
	 If  Not rs.eof Then 
 	  sql=rs.getrows(-1)
	  for i=0 to ubound(sql,2)
 		 If InStr(TemplateContent, "{$node_" & sql(1,i) & "}") > 0 Then
			ModeID=sql(3,i)
			If ModeID="0" Then ModeID=Cint(Application(fycmsN & "ModeID"))
 			DateForm=sql(5,i)
			TitleLen=sql(6,i)
			ContentLen=sql(7,i)
			ListNumber=sql(8,i)
			keywords=sql(10,i)
			ClassID=sql(11,i)
			If ClassID<>"0" Then 
 				If InStr(ClassID, ",") > 0 Then
					 Parameter="ClassID In (" & ClassID & ") And"
				Else
					Parameter="ClassID='" & Replace(ClassID,"'","") & "' And"
				End If 
			 End If 
 			If ListNumber=0 Then ListNumber=10
			If Trim(sql(9,i))=1 Then 
 				If Trim(sql(2,i))<>"" Then Parameter=" id in("&Trim(sql(2,i))&")  and "
				Sqlstr="Select TOP  " & ListNumber & " ID,ClassID,Title,addtime,ActLink,FileName,infopurview,readpoint,PicUrl,Intro,Content,CopyFrom,Author,KeyWords"&fycms.DIYField(ModeID)&" From  "&fycms.ACT_C(ModeID,2)&"  Where  "&Parameter&" isAccept=0 AND delif=0   ORDER BY IsTop Desc,ID Desc"  
 				DiyContents=ACT_L.fycms_A_Code(SqlStr,TitleLen,"",DateForm,Trim(sql(4,i)),ModeID,ContentLen) 
			Else 
 				Sqlstr="Select TOP  " & ListNumber & " ID,ClassID,Title,addtime,ActLink,FileName,infopurview,readpoint,PicUrl,Intro,Content,CopyFrom,Author,KeyWords"&fycms.DIYField(ModeID)&" From  "&fycms.ACT_C(ModeID,2)&"  Where title like '%" & keywords & "%' and "&Parameter&" isAccept=0 AND delif=0   ORDER BY IsTop Desc,ID Desc"  
 			 DiyContents=ACT_L.fycms_A_Code(SqlStr,TitleLen,"",DateForm,Trim(sql(4,i)),ModeID,ContentLen) 
 			End If 
 			 Parameter=""
			 TemplateContent = Replace(TemplateContent,"{$node_" & sql(1,i) & "}",DiyContents)
 		 Else
		  TemplateContent = Replace(TemplateContent,"{$node_" & sql(1,i) & "}","")
		 End If
 		next	 
	  End If 

       Set rs=fycms.actexe("select id,title,picurl from SpecialPicUrl_fy where sid="&id&"")
	   If Not  rs.eof Then 
	   sql=rs.getrows(-1)
		  for i=0 to ubound(sql,2)
				If InStr(TemplateContent, "{$SpecialPic_"&sql(0,i)&"_"&sql(1,i)&"}") > 0 Then
					 TemplateContent = Replace(TemplateContent,"{$SpecialPic_"&sql(0,i)&"_"&sql(1,i)&"}",fycms.PathDoMain&Trim(sql(2,i)))
				Else
					 TemplateContent = Replace(TemplateContent,"{$SpecialPic_"&sql(0,i)&"_"&sql(1,i)&"}","")
				End If 
	 
		  Next 
		End If 
		TemplateContent = ACT_L.LabelReplaceAll(TemplateContent)
		TemplateContent=ACT_L.fycmsexe(TemplateContent)
		loads=TemplateContent 
    End Function 

  End Class
Dim ACTSpecial
Set ACTSpecial = New Cls_Special
 echo ACTSpecial.loads

 %>  