<!--#include file="../tgzcm.Cache/tgzcm.Admin.asp"-->
<!--#include file="../tgzcm.Cache/tgzcm.Html.asp"-->
<%
'tgzcm_Lable_Html(读取模板标签源代码)>>>Get_Lable_List/Get_Lable_Search(用来匹配标签的条件,处理SQL语句)>>>Get_Html_List(最底层用来替换标签)
Dim list_id,m,n,z,i,page,List_Page,tgzcm_title
Dim L1,L2,L3,L4,L5,L6,L7,L8,L9,L10
Dim S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,P1,P2,P3,Pop
Dim ListUrl,DataUrl,PicUrl,List_Html,Order_html
'正则表达式相关的变量
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.MultiLine = True

Function tgzcm_Lable_Head(strValue)'处理顶部底部标签
    moban = strValue
	'替换公用顶部标签
	If Instr(moban,"@SiteHeader@")>0 Then
		moban=Replace(moban,"@SiteHeader@",tgzcm_Lable_Html(tgzcmPath&"skin/"&tgzcm(12)&"/"&tgzcmId(21)&"tgzcm_header.html"))
	End If
	'替换公用底部标签
	If Instr(moban,"@SiteFooter@")>0 Then
		moban=Replace(moban,"@SiteFooter@",tgzcm_Lable_Html(tgzcmPath&"skin/"&tgzcm(12)&"/"&tgzcmId(21)&"tgzcm_footer.html"))
	End If
End Function


'TgzcmCms V1.8新增功能,一级分类循环所有二级分类列表
Function tgzcm_Lable_Listfor(strValue)'得到一级分类循环列表版面设计的HTML代码
    Dim strCustom, strParameter
	strCustom = strValue
    regEx.Pattern = "@tgzcmListfor\((.*?)\)@([\s\S]*?)@\/tgzcmListfor@"
    Set Matches = regEx.Execute(strCustom)
    For Each Match In Matches
		strCustom=Replace(strCustom,Match.value,Get_Lable_Listfor(Match.SubMatches(0), Match.SubMatches(1)))
    Next
    moban = strCustom
End Function

Function tgzcm_Lable_List(strValue)   '得到循环列表版面设计的HTML代码
    Dim strCustom, strParameter
	strCustom = strValue
    regEx.Pattern = "@tgzcmList\((.*?)\)@([\s\S]*?)@\/tgzcmList@"
    Set Matches = regEx.Execute(strCustom)
    For Each Match In Matches
		strCustom=Replace(strCustom,Match.value,Get_Lable_List(Match.SubMatches(0), Match.SubMatches(1)))
    Next
    moban = strCustom
End Function

Function tgzcm_Lable_Search(strValue)   '得到搜索列表版面设计的HTML代码
    Dim strCustom, strParameter
	strCustom = strValue
    regEx.Pattern = "@tgzcmSearch\((.*?)\)@([\s\S]*?)@\/tgzcmSearch@"
    Set Matches = regEx.Execute(strCustom)
    For Each Match In Matches
		strCustom=Replace(strCustom,Match.value,Get_Lable_Search(Match.SubMatches(0), Match.SubMatches(1)))
    Next
    moban = strCustom
End Function

Function tgzcm_Lable_News(strValue)   '得到新闻循环列表版面设计的HTML代码
    Dim strCustom, strParameter
	strCustom = strValue
    regEx.Pattern = "@tgzcmNews\((.*?)\)@([\s\S]*?)@\/tgzcmNews@"
    Set Matches = regEx.Execute(strCustom)
    For Each Match In Matches
		strCustom=Replace(strCustom,Match.value,Get_Lable_News(Match.SubMatches(0), Match.SubMatches(1)))
    Next
    moban = strCustom
End Function

Function tgzcm_Lable_Data(strList)    '得到影片内容页版面设计的HTML代码
	Set rs = Server.CreateObject("adodb.recordset")
	sql = " select * from tgzcm_name where name_id="&name_id&" "
	rs.Open sql, Conn, 1, 1
	If Not(rs.bof And rs.eof) Then
		moban=Get_Html_List(strList,2)
		list_id=rs("class_id")
	Else
		moban = "没有记录"
	End If
	rs.Close
	Set rs=nothing
End Function 

'********************************TgzcmCms V1.0新代码*****************************************

Function tgzcm_Lable_Product(strValue)   '得到奖品循环列表版面设计的HTML代码
    Dim strCustom, strParameter
	strCustom = strValue
    regEx.Pattern = "@tgzcmProduct\((.*?)\)@([\s\S]*?)@\/tgzcmProduct@"
    Set Matches = regEx.Execute(strCustom)
    For Each Match In Matches
		strCustom=Replace(strCustom,Match.value,Get_Lable_Product(Match.SubMatches(0), Match.SubMatches(1)))
    Next
    moban = strCustom
End Function

'***************************************
'函数名：Get_Lable_Listfor V1.8新增功能
'作  用：处理循环标签条件
'参  数: strTemp 标签参数
'参  数: strList 循环内容
'用  处: 一级分类循环二级分类,读取一级分类列表
'****************************************
Function Get_Lable_Listfor(strTemp,strList)
List=Split(strTemp,",")
If Ubound(List)<1 Then
    Get_Lable_Listfor="<h1>循环标签参数不正确,请检查!</h1>"
Else
	L1=Cint(List(1))'推序方法 1,2
	If L1=1 then S1="order by class_id asc" Else S1="order by class_id desc" End if
	'启用列表一级分类
	C1=Cint(list_id)
	Set brs = Server.CreateObject("adodb.recordset")
	brs.open"Select class_id,class_name from tgzcm_class Where class_bigid>0 and class_bigid="&C1&" "&S1&"",conn,1,1
	List_Html=""
	If Not(brs.bof And brs.eof) Then
	   Do While Not brs.eof
	      Call GetLinkPath(brs("class_id"),0)
		  List_str=Replace(strList,"@ClassName@",brs("class_name"))
		  List_str=Replace(List_str,"@ClassId@",brs("class_id"))
		  List_str=Replace(List_str,"@More@",ListUrl)'处理全部的内部链接
	      List_Html=List_Html&List_str
	    brs.movenext
	   Loop
	Else
	     List_Html="<li>暂无相关二级分类！</li>"
	brs.close
	Set brs=nothing
	End if
	Get_Lable_Listfor=List_Html
End If
End Function

'***************************************
'函数名：Get_Lable_List
'作  用：处理循环标签条件
'参  数: strTemp 标签参数
'参  数: strList 循环内容
'用  处: 列表页+全站的循环
'****************************************
Function Get_Lable_List(strTemp,strList)
List=Split(strTemp,",")
If Ubound(List)<9 Then
    Get_Lable_List="<h1>循环标签参数不正确,请检查!</h1>"
Else
	L2=PE_CLng(List(1))'影片数
	L3=List(2)'是否热门
	L4=List(3)'是否推荐
	L5=List(4)'是否连载
	L6=List(5)'是否分页
	L7=Cint(List(6))'推序方法 1,2,3,4,5,6
	L8=Cint(List(7))'标题最多字符
	L9=Cint(List(8))'主演最多字符
	L10=Cint(List(9))'内容最多字符
	If IsNumeric(List(0))=False Then
	    If Instr(List(0),"|")>0 Then S1="and class_id in("&Replace(List(0),"|",",")&")" Else S1="" End If
	Else
		L1=PE_CLng(List(0))
		If L1=-1 Then L1=list_id'当前分类
		If L1=0 Then S1="" Else S1="and (class_id="&L1&" or class_id in (select class_id from tgzcm_class where class_bigid="&L1&"))" End If
	End If	
    If L2=0 Then S2="" Else S2="top "&L2&"" End If
	If L3="True" Then S3="and data_hits>="&tgzcm(10)&"" Else S3="" End If
	If L4="True" Then S4="and data_elite=1" Else S4="" End If
	If L5="True" Then S5="and data_continu=1" Else S5="" End If
	If L7="1" then 
		S7="order by name_id desc" 
	ElseIf L7="2" then 
		S7="order by name_id asc" 
	ElseIf L7="3" then
		If tgzcm(4)="SQL" Then
		S7="order by data_lastdate desc"
		Else 
		S7="order by data_lastdate desc,name_id" 
		End If
	ElseIf L7="4" then 
		If tgzcm(4)="SQL" Then
		S7="order by data_lastdate asc" 
		Else
		S7="order by data_lastdate asc,name_id"
		End If
	ElseIf L7="5" then 
		S7="order by data_hits desc,name_id" 
	ElseIf L7="6" then 
		S7="order by data_hits asc" 
	Else  
		S7=""								
	End If
	Set rs = Server.CreateObject("adodb.recordset")
	If Ranks>0 Then
	 if Ranks=1 then RankAction="order by data_lastdate desc" End if
	 if Ranks=2 Then RankAction="order by data_hits desc,name_id" End if
	 if Ranks=3 Then RankAction="and data_elite=1 order by data_lastdate desc" End If
	 '
	 Sql = "select "&S2&" * from tgzcm_name where data_status=1 "&S1&" "&RankAction&""
	Else
	 Sql = "select "&S2&" * from tgzcm_name where data_status=1 "&S3&" "&S1&" "&S4&" "&S5&" "&S7&""
	End if
	rs.Open sql, Conn, 1, 1
	List_Html=""
	If Not(rs.bof And rs.eof) Then
	    i=0
		If L6="True" Then'分页
			rs.pagesize=tgzcm(11)'每页数量
			rs.AbsolutePage=page
			m=rs.recordcount     '总记录
			n=rs.PageCount       '总页数
			z=rs.pagesize        '每页数量
			Do while not rs.eof and i<rs.pagesize
			List_str=Get_Html_List(strList,1)'调用替换标签的函数
			List_Html=List_Html&List_str
			i=i+1
			rs.movenext
			Loop
			Call GetLinkPage(list_id,page,Ranks)'''''''''''处理分页标签的链接	
		Else
		    Do while not rs.eof
			List_str=Get_Html_List(strList,1)'调用替换标签的函数
			List_Html=List_Html&List_str		
			i=i+1
			rs.movenext
			Loop
		End If
	Else
	    List_Html="<li>暂无相关数据！</li>"
	End If
	rs.Close
	Set rs=nothing
	Get_Lable_List=List_Html
End If
End Function

'***************************************
'函数名：Get_Lable_Search
'作  用：处理搜索循环标签的条件
'****************************************
Function Get_Lable_Search(strTemp,strList)
List=Split(strTemp,",")
If Ubound(List)<>3 Then
	Get_Lable_Search="<h1>循环标签参数不正确,请检查!</h1>"
Else
    L8=Cint(List(1)) '标题最多字符
	L9=Cint(List(2)) '主演最多字符
	L10=Cint(List(3))'内容最多字符
	If List(0)=0 Then S1="" Else S1="top "&Clng(List(0))&"" End If'通过参数获得查询多少记录
	If searchtype="name" Then
		If tgzcm(4)="SQL" Then
		    sql="Select "&S1&" * from tgzcm_name where data_name like '%"&keyword&"%' and data_status=1 order by name_id desc"
		Else'启用InStr,LCase函数过滤小日本
		    sql="Select "&S1&" * from tgzcm_name where InStr(1,LCase(data_name),LCase('"&keyword&"'),0)<>0 and data_status=1 order by name_id desc"
		End If
	ElseIf searchtype="actor" Then
		If tgzcm(4)="SQL" Then
			sql="Select "&S1&" * from tgzcm_name where data_actor like '%"&keyword&"%' and data_status=1 order by name_id desc"
		Else'启用InStr,LCase函数过滤小日本
			sql="Select "&S1&" * from tgzcm_name where InStr(1,LCase(data_actor),LCase('"&keyword&"'),0)<>0 and data_status=1 order by name_id desc"
		End If
	ElseIf searchtype="director" Then
		If tgzcm(4)="SQL" Then
			sql="Select "&S1&" * from tgzcm_name where data_director like '%"&keyword&"%' and data_status=1 order by name_id desc"
		Else'启用InStr,LCase函数过滤小日本
			sql="Select "&S1&" * from tgzcm_name where InStr(1,LCase(data_director),LCase('"&keyword&"'),0)<>0 and data_status=1 order by name_id desc"
		End If	
	ElseIf searchtype="year" Then
		sql="Select "&S1&" * from tgzcm_name where data_year="&Clng(keyword)&" order by name_id desc"	
	ElseIf searchtype="erea" Then
		sql="Select "&S1&" * from tgzcm_name where data_erea like '%"&keyword&"%' order by name_id desc"			
	Else
		Call tgzcm_err_c("TgzcmCms.Err:请勿乱来！")
		Response.End
	End If
	'''''''''''
	Set rs = Server.CreateObject("adodb.recordset")
	rs.Open sql, Conn, 1, 1
	List_Html=""
	If Not(rs.bof And rs.eof) Then
		i=0
		If List(0)=0 Then'分页
			rs.pagesize=tgzcm(11)'每页数据
			rs.AbsolutePage=page
			m=rs.recordcount     '总记录
			n=rs.PageCount       '总页数
			z=rs.pagesize        '每页数量
			Do while not rs.eof and i<rs.pagesize
			'''''''''''''''''''''''''''''''''''
			List_str=Get_Html_List(strList,1)'调用替换标签的函数
			List_Html=List_Html&List_str
			'''''''''''''''''''''''''''''''''''
			i=i+1
			rs.movenext
			Loop
			'有分页标签则进行处理分页链接
			List_Page=ShowPage("Search.asp?Action="&searchtype&"&keyword="&keyword&"", m, tgzcm(11), page, True, True, "条", False)
		Else
			Do while not rs.eof
			'''''''''''''''''''''''''''''''''''
			List_str=Get_Html_List(strList,1)'调用替换标签的函数
			List_Html=List_Html&List_str		
			i=i+1
			rs.movenext
			Loop
		End If
	Else
		List_Html="<li>暂无相关数据！</li>"
	End If
	rs.Close
	Set rs=nothing		
End If
	Get_Lable_Search=List_Html
End Function

'***************************************
'函数名：Get_Html_List
'说  明：替换所有标签的公用函数
'参  数: strList 替换前的模板源代码
'参  数: strType 1=替换循环标签 2=替换内容页
'****************************************
Function Get_Html_List(strList,strType)
	Call GetLinkPath(rs("class_id"),rs("name_id"))'处理全部的内部链接
	If Instr(rs("data_picsmall"),"http://")>0 Then
		PicUrl=Trim(rs("data_picsmall"))
	Else
		PicUrl=tgzcmId(26)&tgzcmPath&Trim(rs("data_picsmall"))
	End If
	If Instr(rs("data_picbig"),"http://")>0 Then
		PicUrll=Trim(rs("data_picbig"))
	Else
	    PicUrll=tgzcmId(26)&tgzcmPath&Trim(rs("data_picbig"))
	End if	
	List_str=Replace(strList,"@Number@",i+1)
	List_str=Replace(List_str,"@DataId@",rs("name_id"))
	List_str=Replace(List_str,"@ClassId@",rs("class_id"))
	List_str=replace(List_str,"@ClassName@","<a href="""&ListUrl&""" target=""_blank"">"&GetClassName(rs("class_id"))&"</a>")'
	List_str=replace(List_str,"@ClassMing@",GetClassName(rs("class_id")))
	List_str=Replace(List_str,"@NameMing@",rs("data_name"))
	List_str=Replace(List_str,"@DataUrl@",DataUrl)
	List_str=Replace(List_str,"@ClassUrl@",ListUrl)
	List_str=Replace(List_str,"@Director@",GetDirector(GetReplace(rs("data_director"))))
	List_str=Replace(List_str,"@Erea@",GetReplace(rs("data_erea")))
	List_str=Replace(List_str,"@Hits@",formatnumber(rs("data_hits"),0))
	List_str=Replace(List_str,"@PicSmall@",PicUrl)'小图路径
	List_str=Replace(List_str,"@PicBig@",PicUrll)'大图路径
	If Instr(List_str,"@Hot@")>0 and rs("data_hits") > Cint(tgzcm(10)) Then
	List_str=Replace(List_str,"@Hot@","<img src="""&tgzcmPath&"Images/hot.gif"" border=""0"" />")
	Else
	List_str=Replace(List_str,"@Hot@","")
	End If
	If Instr(List_str,"@Elite@")>0 and rs("data_elite") = 1 Then
	List_str=Replace(List_str,"@Elite@","<img src="""&tgzcmPath&"Images/elite.gif"" border=""0"" />")
	Else
	List_str=Replace(List_str,"@Elite@","")
	End If	
	If Instr(List_str,"@New@")>0 and DateDiff("D", rs("data_lastdate"), Now()) < Cint(tgzcmId(22)) Then
	List_str=Replace(List_str,"@New@","<img src="""&tgzcmPath&"Images/new.gif"" border=""0"" />")
	Else
	List_str=Replace(List_str,"@New@","")
	End If
	List_str=Replace(List_str,"@Year@",GetReplace(rs("data_year")))
	List_str=Replace(List_str,"@Language@",GetReplace(rs("data_language")))
	If strType=1 Then
	List_str=Replace(List_str,"@DataName@","<a href="""&DataUrl&""" target=""_blank"">"&GetColor(GetCu(GetSubStr(rs("data_name"),L8,True),rs("data_cu")),rs("data_color"))&"</a>")
	List_str=Replace(List_str,"@DataMing@",GetColor(GetCu(GetSubStr(rs("data_name"),L8,True),rs("data_cu")),rs("data_color")))
	List_str=Replace(List_str,"@Actor@",GetActor(GetSubStr(rs("data_actor"),L9,True)))
	List_str=Replace(List_str,"@Intro@",GetSubStr(ReplaceHtml(rs("data_intro")),L10,True))	
	List_str=Replace(List_str,"@Time@",tgzcm_Time(rs("data_lastdate"),1))
	List_str=Replace(List_str,"@Time1@",tgzcm_Time(rs("data_lastdate"),2))
	List_str=Replace(List_str,"@Time2@",tgzcm_Time(rs("data_lastdate"),3))
	List_str=Replace(List_str,"@Time3@",tgzcm_Time(rs("data_lastdate"),4))
	List_str=Replace(List_str,"@Time4@",tgzcm_Time(rs("data_lastdate"),5))
	List_str=Replace(List_str,"@Time5@",tgzcm_Time(rs("data_lastdate"),6))
	List_str=Replace(List_str,"@LianZai@",LzReplace(GetReplace(rs("data_reurl")),rs("class_id")))
	Else
	List_str=Replace(List_str,"@Titele@",rs("data_name"))
	List_str=Replace(List_str,"@DataName@",rs("data_name"))
	List_str=Replace(List_str,"@DataMing@",rs("data_name"))
	List_str=Replace(List_str,"@Actor@",GetActor(rs("data_actor")))
    List_str=Replace(List_str,"@Actorr@",rs("data_actor"))
	List_str=Replace(List_str,"@Intro@",rs("data_intro"))
	List_str=Replace(List_str,"@Time@",tgzcm_Time(rs("data_lastdate"),1))
	List_str=Replace(List_str,"@Time1@",tgzcm_Time(rs("data_lastdate"),2))
	List_str=Replace(List_str,"@Time2@",tgzcm_Time(rs("data_lastdate"),3))
	List_str=Replace(List_str,"@Time3@",tgzcm_Time(rs("data_lastdate"),4))
	List_str=Replace(List_str,"@Time4@",tgzcm_Time(rs("data_lastdate"),5))
	List_str=Replace(List_str,"@Time5@",tgzcm_Time(rs("data_lastdate"),6))
	List_str=Replace(List_str,"@LianZai@",LzReplace(GetReplace(rs("data_reurl")),rs("class_id")))
	'QVOD服务组
	If Instr(List_str,"@QvodA@")>0 Then List_str=Replace(List_str,"@QvodA@",GetPlayUrl(rs("name_id"),rs("data_name"),1))
	If Instr(List_str,"@QvodB@")>0 Then List_str=Replace(List_str,"@QvodB@",GetPlayUrl(rs("name_id"),rs("data_name"),2))
	If Instr(List_str,"@QvodC@")>0 Then List_str=Replace(List_str,"@QvodC@",GetPlayUrl(rs("name_id"),rs("data_name"),3))
	'Govd服务组
	If Instr(List_str,"@GvodA@")>0 Then List_str=Replace(List_str,"@GvodA@",GetPlayUrlG(rs("name_id"),rs("data_name"),1))
	If Instr(List_str,"@GvodB@")>0 Then List_str=Replace(List_str,"@GvodB@",GetPlayUrlG(rs("name_id"),rs("data_name"),2))
	If Instr(List_str,"@GvodC@")>0 Then List_str=Replace(List_str,"@GvodC@",GetPlayUrlG(rs("name_id"),rs("data_name"),3))
	End If	
	Get_Html_List=List_str
End Function


'*************************************************************'News.Star********************************************************

'函数名：Get_Html_News
Function tgzcm_Lable_NewsData(strList)
	Set rs = Server.CreateObject("adodb.recordset")
	sql = " select * from tgzcm_News where id="&id&" "
	rs.Open sql, Conn, 1, 1
	If Not(rs.bof And rs.eof) Then
	    Conn.Execute("update tgzcm_News Set hits=hits+1 where id="&id&"")
		moban=Get_Html_News(strList,2)
	Else
		moban = "没有新闻记录"
	End If
	rs.Close
	Set rs=nothing
End Function 

'***************************************
'函数名：Get_Lable_News
'作  用：处理循环标签条件
'参  数: strTemp 标签参数
'参  数: strList 循环内容
'用  处: 新闻的循环
'****************************************
Function Get_Lable_News(strTemp,strList)
List=Split(strTemp,",")
If Ubound(List)<2 Then
    Get_Lable_News="<h1>新闻循环标签参数不正确,请检查!</h1>"
Else
	S1=PE_CLng(List(0))'新闻数
	S2=PE_CLng(List(1))'标题数
	S3=List(2)'是否分页
	If S1<=0 then S4="" Else S4="top "&S1&"" End If
	Set rs = Server.CreateObject("adodb.recordset")
	Sql = "select "&S4&" * from tgzcm_News order by datetimes desc"
	rs.Open sql, Conn, 1, 1
	List_Html=""
	If Not(rs.bof And rs.eof) Then
	    i=0
		If S3="True" Then'分页
			rs.pagesize=tgzcm(18)'每页数量
			rs.AbsolutePage=page
			m=rs.recordcount     '总记录
			n=rs.PageCount       '总页数
			z=rs.pagesize        '每页数量
			Do while not rs.eof and i<rs.pagesize
			List_str=Get_Html_News(strList,1)'调用替换标签的函数
			List_Html=List_Html&List_str	
			i=i+1
			rs.movenext:Loop
			Call GetNewsPage(list_id,page,Ranks)'''''''''''处理分页标签的链接	
		Else
		    Do while not rs.eof
			List_str=Get_Html_News(strList,1)'调用替换标签的函数
			List_Html=List_Html&List_str	
			i=i+1
			rs.movenext:Loop
		End If
	Else
	    List_Html="<li>暂无相关新闻数据！</li>"
	End If
	rs.Close
	Set rs=nothing
	Get_Lable_News=List_Html
End If
End Function

'***************************************
'函数名：Get_Html_News
'说  明：替换所有标签的公用函数
'参  数: strList 替换前的模板源代码
'参  数: strType 1=替换循环标签 2=替换内容页
'****************************************
Function Get_Html_News(strList,strType)
	Call GetNewsLinkPath(rs("id"))'处理全部的内部链接
	List_str=Replace(strList,"@NewsNum@",i+1)
	If Instr(List_str,"@NewCon@")>0 and DateDiff("D", rs("datetimes"), Now()) < Cint(tgzcmId(22)) Then
	List_str=Replace(List_str,"@NewCon@","<img src="""&tgzcmPath&"Images/new.gif"" border=""0"" />")
	Else
	List_str=Replace(List_str,"@NewCon@","")
	End If
	List_str=Replace(List_str,"@NewsId@",rs("id"))
	List_str=Replace(List_str,"@NewsTime@",tgzcm_Time(rs("datetimes"),2))
	List_str=Replace(List_str,"@NewsMing@",rs("Title"))'不带任何html代码
	List_str=Replace(List_str,"@NewsUrl@",DataUrl)
	List_str=Replace(List_str,"@NewsHits@",rs("hits"))
	List_str=Replace(List_str,"@NewsContent@",rs("Content"))
	List_str=Replace(List_str,"@NewsName@",GetColor(GetSubStr(rs("Title"),S2,True),rs("color")))
	Get_Html_News=List_str
End Function 
'*************************************************************'News.End********************************************************

'***********************************************************'Product.Star******************************************************

'函数名：Get_Html_Product
Function tgzcm_Lable_ProductData(strList)
	Set rs = Server.CreateObject("adodb.recordset")
	sql = " select * from tgzcm_product where pid="&pid&" "
	rs.Open sql, Conn, 1, 1
	If Not(rs.bof And rs.eof) Then
		moban=Get_Html_Product(strList,2)
	Else
		moban = "没有奖品记录"
	End If
	rs.Close
	Set rs=nothing
End Function 

'***************************************
'函数名：Get_Lable_Order
'作  用：处理兑换记录条件
'****************************************
Function Get_Lable_Order(pid)
   Set rs = Server.CreateObject("adodb.recordset")
   rs.open"Select* from tgzcm_order where opid="&pid&" order by oid desc",conn,1,1
   If Not(rs.bof And rs.eof) Then
		Order_html=Order_html&"<table width='99%' id='order' border='0' align='center' cellpadding='0' cellspacing='0'><tr>"
		Order_html=Order_html&"<td width='17%' height='23'>&nbsp;会员用户</td>"
		Order_html=Order_html&"<td width='7%' align='center'>兑换数量</td>"
		Order_html=Order_html&"<td width='28%'align='center'>支付宝及特别说明</td>"
		Order_html=Order_html&"<td width='13%'align='center'>QQ号码</td>"
		Order_html=Order_html&"<td width='13%'align='center'>兑换时间</td>"
		Order_html=Order_html&"<td width='9%' align='center'>发货状态</td>"
		Order_html=Order_html&"<td width='13%'align='center'>发货时间</td></tr>"
		Do while not rs.eof
		Order_html=Order_html&"<tr>"
		Order_html=Order_html&"<td height='23'>&nbsp;"&Get_tgzcm_User(rs("ouid"))&"</td>"
		Order_html=Order_html&"<td align='center'>"&rs("ohow")&"</td>"
		Order_html=Order_html&"<td>&nbsp;"&Left(rs("oadd"),12)&"****</td>"
		Order_html=Order_html&"<td align='center'>"&Left(rs("otel"),7)&"****</td>"
		Order_html=Order_html&"<td align='center'>"&tgzcm_Time(rs("otime"),2)&"</td>"
		Order_html=Order_html&"<td align='center'>"&ProdStar(rs("ostar"))&"</td>"
		Order_html=Order_html&"<td align='center'>"&tgzcm_Time(rs("oktime"),2)&"</td>"
		Order_html=Order_html&"</tr>"
		rs.movenext
		Loop
		Order_html=Order_html&"</table>"	
   Else
		Order_html = "暂无网友兑换记录！！！"
   End If
   rs.Close
   Set rs=nothing 
       Get_Lable_Order=Order_html
End Function

Function Get_tgzcm_User(uid)'调用会员用户名
   Set urs=Conn.execute("Select ulc From tgzcm_user Where uid="&uid&"")
   If Not(urs.eof and urs.bof) Then
    uhtml=urs("ulc")
   End If
   urs.Close
   Set usr=Nothing	
   Get_tgzcm_User=uhtml
End Function
'***************************************
'函数名：Get_Lable_Product
'作  用：处理循环标签条件
'参  数: strTemp 标签参数
'参  数: strList 循环内容
'用  处: 奖品的循环
'****************************************
Function Get_Lable_Product(strTemp,strList)
List=Split(strTemp,",")
If Ubound(List)<2 Then
    Get_Lable_Product="<h1>奖品循环标签参数不正确,请检查!</h1>"
Else
	P1=PE_CLng(List(0))'奖品数
	P2=PE_CLng(List(1))'标题数
	P3=List(2)'是否分页
	If P1<=0 then Pop="" Else Pop="top "&P1&"" End If
	Set rs = Server.CreateObject("adodb.recordset")
	Sql = "select "&Pop&" * from tgzcm_product order by pid desc"
	rs.Open sql, Conn, 1, 1
	List_Html=""
	If Not(rs.bof And rs.eof) Then
	    i=0
		If P3="True" Then'分页
			rs.pagesize=tgzcm(19)'每页数量
			rs.AbsolutePage=page
			m=rs.recordcount     '总记录
			n=rs.PageCount       '总页数
			z=rs.pagesize        '每页数量
			Do while not rs.eof and i<rs.pagesize
			List_str=Get_Html_Product(strList,1)'调用替换标签的函数
			List_Html=List_Html&List_str
			i=i+1
			rs.movenext
			Loop
			Call GetProductPage(list_id,page,Ranks)'''''''''''处理分页标签的链接	
		Else
		    Do while not rs.eof
			List_str=Get_Html_Product(strList,1)'调用替换标签的函数
			List_Html=List_Html&List_str		
			i=i+1
			rs.movenext
			Loop
		End If
	Else
	    List_Html="<li>暂无相关奖品数据！</li>"
	End If
	rs.Close
	Set rs=nothing
	Get_Lable_Product=List_Html
End If
End Function

'***************************************
'函数名：Get_Html_Product
'说  明：替换所有标签的公用函数
'参  数: strList 替换前的模板源代码
'参  数: strType 1=替换循环标签 2=替换内容页
'****************************************
Function Get_Html_Product(strList,strType)
	Call GetProductLinkPath(rs("pid"))'处理全部的内部链接
	ProPicUrl=tgzcmId(26)&tgzcmPath&Trim(rs("pic"))
	List_str=Replace(strList,"@ProductNum@",i+1)
	List_str=Replace(List_str,"@ProductId@",rs("Pid"))
	List_str=Replace(List_str,"@ProductPic@",ProPicUrl)
	List_str=Replace(List_str,"@ProductTime@",tgzcm_Time(rs("ptime"),2))
	List_str=Replace(List_str,"@ProductMing@",rs("pname"))'不带任何html代码
	List_str=Replace(List_str,"@ProductUrl@",DataUrl)
	List_str=Replace(List_str,"@ProductJf@",rs("pjf"))'积分
	List_str=Replace(List_str,"@ProductHow@",rs("pj"))'总数量
	List_str=Replace(List_str,"@ProductOld@",rs("ps"))'剩余数量
	List_str=Replace(List_str,"@ProductContent@",rs("pabout"))'奖品相关说明
    List_str=Replace(List_str,"@ProductName@",GetColor(GetSubStr(rs("pname"),P2,True),rs("pcolor")))
	If strType=2 then
	List_str=Replace(List_str,"@ProductOrder@",Get_Lable_Order(pid))'兑换记录
	End if
	Get_Html_Product=List_str
End Function 
'*************************************************************'Product.End****************************************************


Sub tgzcm_Lable_All(moban)'模板全局单个标签替换
    '正则处理菜单
	regEx.Pattern = "@tgzcmMenu\((.*?)\)@([\s\S]*?)@\/tgzcmMenu@"
	Set Matches = regEx.Execute(moban)
	For Each Match In Matches
	moban=Replace(moban,Match.value,GetMenu(Match.SubMatches(1),Match.SubMatches(0)))
	Next
    '正则处理友链
	regEx.Pattern = "\@\FriendLink\(([\s\S]*?)\)@"
	Set Matches = regEx.Execute(moban)
	For Each Match In Matches
	moban=Replace(moban,Match.value,GetFriendLink(Match.SubMatches(0)))
	Next
    '正则处理统计
    regEx.Pattern = "\@ClassShu\(([\s\S]*?)\)@"
	Set Matches = regEx.Execute(moban)
	For Each Match In Matches
	moban=Replace(moban,Match.value,Clng(GetClassShu(Match.SubMatches(0))))
	Next
	'播放器相关的	
	If Instr(moban,"@tgzcmPlayer@")>0 Then
		moban=Replace(moban,"@tgzcmPlayer@","<script language=""javascript"" type=""text/javascript"" src="""&tgzcmPath&"Play/tgzcmPlayer.js""></script>")	
	End If
	'替换分页标签
	If Instr(moban,"@Page@")>0 Then
		moban=Replace(moban,"@Page@",List_Page)
	End If	
    '最后替换通用标签
	moban=Replace(moban,"@ClosePlayer@","")	
	moban=Replace(moban,"@ErrPlayer@","")	
	moban=Replace(moban,"@DataErr@","")
	moban=Replace(moban,"@PlayerErr@","")
	'	
	moban=Replace(moban,"@Titele@",tgzcm_title)
	moban=Replace(moban,"@InstallDir@",tgzcmPath)
	moban=Replace(moban,"@SiteName@",tgzcm(0))
	moban=Replace(moban,"@SiteUrl@",tgzcm(1))
	moban=Replace(moban,"@Email@",tgzcm(2))
	moban=Replace(moban,"@KeyWord@",tgzcm(15))
	moban=Replace(moban,"@Description@",tgzcm(16))
	moban=Replace(moban,"@Copyright@",tgzcm(13))
	moban=Replace(moban,"@Tong@",tgzcm(14))
	moban=Replace(moban,"@BeiAn@",tgzcmId(14))
	moban=Replace(moban,"@Css@","<link href="""&tgzcmPath&"skin/"&tgzcm(12)&"/style.css"" rel=""stylesheet"" type=""text/css"" />")
	moban=Replace(moban,"@QvodChannel@","<a href=""qvodcha://"&tgzcm(0)&"|http://"&tgzcm(1)&"/Channel.xml"">QVOD频道订阅</a>")
	moban=Replace(moban,"@QvodAdd@","<a href=""qvodadd://"&tgzcm(0)&"|http://"&tgzcm(1)&"/"">加入QVOD收藏</a>")		
End Sub

Function GetMenu(strlist,stytype)
    Dim Menu_Html,Lits_Html,Class_bigid
	If IsNumeric(stytype)=False Then
		GetMenu="@tgzcmMenu(这里的参数不正确请填写数字)@"
		Exit Function
	End If
	Class_bigid=Trim(stytype)
    Set rs = Conn.Execute("Select * from tgzcm_class where class_id in("&Class_bigid&") and class_orderid>0 order by class_orderid asc")
	If Not(rs.bof And rs.eof) Then
	    Menu_Html=""
	    Do while not rs.eof
		    Call GetLinkPath(rs("class_id"),0)'调用该类的真实链接变量ListUrl
            Lits_Html=Replace(strlist,"@MenuId@",rs("class_id"))
			Lits_Html=Replace(Lits_Html,"@MenuName@",rs("class_name"))
			Lits_Html=Replace(Lits_Html,"@MenuEnName@",rs("class_dir"))
			Lits_Html=Replace(Lits_Html,"@MenuUrl@",ListUrl)
			If list_id=rs("class_id") Then '当前分类的CSS
			    Lits_Html=Replace(Lits_Html,"@MenuCss@","MenuCss")
			Else
			    Lits_Html=Replace(Lits_Html,"@MenuCss@","")
			End If
			Menu_Html=Menu_Html&Lits_Html
	    rs.movenext
		Loop
	Else
	    Menu_Html=""
	End If
	rs.Close
	Set rs=Nothing
	GetMenu=Menu_Html
End Function

Function GetListClass(listid,classid)
 	If listid=classid Then GetListClass="tgzcmlist" Else GetListClass="" End If '当前列表的CSS类
End Function

Function GetFriendLink(str)
    Dim FriendLink
    Set rs_f = Conn.Execute("Select * from tgzcm_link order by link_id desc")
	If Not(rs_f.bof And rs_f.eof) Then
	   Do while not rs_f.eof
			If str=1 Then'图片模式 
				FriendLink=FriendLink&"<li><a href="""&rs_f("link_url")&""" target=""_blank""><img src="""&rs_f("link_logo")&""" alt="""&rs_f("link_name")&""" width=""88"" height=""31"" border=""0""></a></li>"& vbCrLf&""
			Else
				FriendLink=FriendLink&"<a href="""&rs_f("link_url")&""" target=""_blank"">"&rs_f("link_name")&"</a>"& vbCrLf&""
			End If
		rs_f.movenext
		Loop
	Else
	    FriendLink="<a href=""#"">没有其它友链</a>"
	End If
	rs_f.close
	Set rs_f=nothing
	GetFriendLink=FriendLink
End Function

Function GetClassShu(ShuType)
	If ShuType=0 Then'所有
	    Set Shu=Conn.execute("select count(name_id) from tgzcm_name")
	ElseIf ShuType=999 Then'今日
	    If tgzcm(4)="SQL" Then
		Set Shu=Conn.execute(" select count(name_id) from tgzcm_name where datediff(d,data_lastdate,getdate())=0 ")
	    Else
		Set Shu=Conn.execute(" select count(*) from tgzcm_name where datediff('d',data_lastdate,now())=0 ")
	    End If			
	Else
	    Set Shu=Conn.execute(" select count(name_id) from tgzcm_name where (class_id="&ShuType&" or class_id in (select class_id from tgzcm_class where class_bigid="&ShuType&")) ")
	End If
	GetClassShu=Shu(0)
	Set Shu=Nothing
End Function
%>