功能:根据文章字数以及内容页是否含有上传的图片、FLSAH代码等自动判断是否加载画中画。
下面是修改方法:
打开KS_Cls/Kesion.Label.CommonCls.asp,找到Function ReplaceAD(ByVal Content,ClassID)这个函数,在其上面增加:
以下内容只有回复后才可以浏览,请先登录! 往下,对应修改Function ReplaceAD(ByVal Content,ClassID)函数。
- '替换画中画广告
- Function ReplaceAD(ByVal Content,ClassID)
- Dim ShowADTF,CLen,Dir,Width,Height,AdUrl,AdLinkUrl,LC,RC,AdStr,ADType
- Dim ClassBasicInfo:ClassBasicInfo=KS.C_C(ClassID,6)
- Dim ImgFileName:ImgFileName=GetImgFiles(Content)If ClassBasicInfo="" Then Exit Function
- Dim AdP:AdP = Split(Split(ClassBasicInfo,"||||")(4),"%ks%")
- ShowADTF=KS.ChkClng(Adp(0))
- If ShowADTF=0 Then ReplaceAD=Content:Exit Function
- Dim Param:Param=Split(AdP(1),",")
- '截取字符串长度
- If Len(Content)<KS.ChkClng(Param(0)) Then
- Clen=Len(Content)/2
- Else
- Clen=KS.ChkClng(Param(0))
- End If
CLen=KS.ChkClng(Param(0)):Dir=Param(1):Width=KS.ChkClng(Param(2)):Height=KS.ChkClng(Param(3)):AdUrl=Adp(3):AdLinkUrl=Adp(4):ADType=KS.ChkClng(ADP(2)) - If CLen<>0 Then LC=InterceptString(Content,Clen)
- RC=Right(Content,Len(Content)-Len(LC))
- If ADType=2 Then
- Adstr="<table border=""0"" width="""& Width & """ height=""" & Height & """ align="""&Dir&"""><tr><td>" & AdUrl & "</td></tr></table>"
- Else
- If Lcase(Right(AdUrl,3))="swf" Then'判断是否Swf图片
- AdStr="<table width=""0"" border=""0"" align="""&Dir&""" style=""margin-top:5px;margin-right:10px""><tr><td><object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"" height=""" & Height & """ width="""&Width&""" ><param name=""movie"" value="""&AdUrl&"""><param name=""quality"" value=""high""><embed src="""&AdUrl&""" quality=""high"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" type=""application/x-shockwave-flash"" height=""" & Height & """ width="""&Width&"""></embed></object></td></tr></table>"
- Else
- If AdLinkUrl="" Then AdLinkUrl="../"
- AdStr="<table width=""0"" border=""0"" align="""&Dir&""" style=""margin-top:5px;margin-right:10px""><tr><td><a href="""&AdLinkUrl&""" target=""_blank""><img border=""0"" src="""&AdUrl&""" height=""" & Height & """ width="""&Width&"""></a></td></tr></table>"
- End If
- End If
- '自动判断是否显示画中画广告
- If Len(Content)<KS.ChkClng(Param(0)) Or ImgFileName<>"" Then AdStr=""
ReplaceAD=LC & AdStr & RC - End Function
欢迎大家测试。