📄 cl_function_photo.asp
字号:
strValue=Replace(strValue,"{$classname}",sqlRoot(1,iClassID))
strValue=Replace(strValue,"{$classfileurl}",ClassLinkUrl)
strValue=Replace(strValue,"{$classlinkurl}",ClassLinkUrl)
strValue=Template.ReplaceFlag(strValue,"showphoto","")
If iClassID<nClassID then
if ((iClassID+1) mod ModNum) = 0 then
strValue = strValue & TemplateHTMLStr(3)
else
strValue = strValue & TemplateHTMLStr(2)
end If
End if
sTemp=sTemp & strValue
Next
ShowClassPhoto=Replace(TemplateHTMLStr(0),"{$classphotobody}",sTemp)
TemplateHTMLStr = Null
sqlRoot=Empty
End Function
'====================================================================================================
'过程:ShowPicPhoto(sChannelID,sClassID,sSpecialID,TopNum,TitleLen,ShowType,Cols,ImgWidth,ImgHeight,ContentLen,IsHot,IsElite)
'参数:
' sChannelID ------ 频道ID
' sClassID ------ 栏目ID(0为所有栏目,若大于0,则调用指定栏目及其子栏目)
' sSpecialID ------ 专题ID(0为所有栏目,若大于0,则调用指定地区)
' TopNum ------ 最多显示多少篇
' TitleLen ------ 标题最多字符数
' ShowType ------ 显示方式。0(图),1(图+标),2(图+标+内),3(图+幻),4(图+标+幻)
' Cols ------ 列数。超过此列数就换行
' ImgWidth ------ 图片宽度
' ImgHeight ------ 图片高度
' ContentLen ------ 内容最多字符数
' IsHot ------ 是否是热门(True为是,False为否)
' IsElite ------ 是否是推荐(True为是,False为否)
'====================================================================================================
Function ShowPicPhoto(Byval sChannelID,Byval sClassID,Byval sSpecialID, _
Byval TopNum,Byval TitleLen,Byval ShowType,Byval Cols,Byval ImgWidth, _
Byval ImgHeight,Byval ContentLen,Byval IsHot,Byval IsElite)
On Error Resume Next
sChannelID = Clng(sChannelID) : sClassID = Clng(sClassID)
sSpecialID = Clng(sSpecialID) : TopNum = Clng(TopNum)
TitleLen = Clng(TitleLen) : ShowType = Clng(ShowType)
Cols = Clng(Cols) : ImgWidth = Clng(ImgWidth)
ImgHeight = Clng(ImgHeight) : ContentLen = Clng(ContentLen)
IsHot = CBool(IsHot) : IsElite = CBool(IsElite)
if Err then Err.Clear : ShowPicPhoto="ShowPicPhoto参数错误。":Exit Function
On Error GoTo 0
dim rsPic,sqlPic,tClass,j,strPic
if TopNum<=0 then
sqlPic="Select "
else
sqlPic="Select top "&TopNum&" "
end if
sqlPic=sqlPic & " InfoID,ChannelID,ChannelDir,ClassID,PhotoName,Author,AuthorEmail,Editor,Keyword,Hits,DayHits,WeekHits,MonthHits,UpdateTime,PicUrl,OnTop,Elite,Status,Intro,InfoGroup,InfoPoint,Stars,IsHtml,HtmlFileUrl from Cl_Photo where Deleted="&FalseType&" and Status=1 and PicUrl<>'' "
if sChannelID>0 then sqlPic=sqlPic & " and ChannelID="&sChannelID&" "
if sClassID>0 then
set tClass=Cl.Execute("select ClassID,Child,ParentPath,arrChildID from Cl_Class where ChannelID="&sChannelID&" and ClassID=" & sClassID)
if not(tClass.bof and tClass.eof) then
if tClass(1)>0 then
sqlPic=sqlPic & " and ClassID in (" & tClass(3) & ")"
else
sqlPic=sqlPic & " and ClassID=" & sClassID
end if
else
sqlPic=sqlPic & " and ClassID=" & sClassID
end if
set tClass=Nothing
end if
if sSpecialID>0 then sqlPic=sqlPic & " and SpecialID Like '%," & sSpecialID & ",%'"
if IsHot=True then sqlPic=sqlPic & " and Hot="&TrueType&" "
if IsElite=True then sqlPic=sqlPic & " and Elite="&TrueType&" "
if IsSqlDataBase=1 then
sqlPic=sqlPic & " order by OnTop Desc,UpdateTime desc,InfoID desc"
Else
sqlPic=sqlPic & " order by OnTop Asc,UpdateTime desc,InfoID desc"
End if
Set rsPic= Server.CreateObject("ADODB.Recordset")
OpenConn : rsPic.open sqlPic,Conn,1,1
if rsPic.bof and rsPic.eof then
strPic = strPic & "<img src=""" & Cl.WebDir & "images/NoPic.gif"" width=""" & ImgWidth & """ height=""" & ImgHeight & """ border=""0"">"
rsPic.Close : Set rsPic = Nothing
else
dim FileType,TitleStr,LinkUrl
if TopNum<=0 or TopNum>=100 then
TotalPut=rsPic.recordcount
if (TotalPut mod PageSize)=0 then
TotalPages = TotalPut \ PageSize
else
TotalPages = TotalPut \ PageSize + 1
end if
if CurrentPage > TotalPages then CurrentPage=TotalPages
if CurrentPage < 1 then CurrentPage=1
rsPic.move (CurrentPage-1)*PageSize
sqlPic = rsPic.GetRows(PageSize)
else
sqlPic=rsPic.GetRows(-1)
end if
rsPic.Close : Set rsPic = Nothing
Select Case ShowType
Case 0
strPic = "<table width=""100%"" cellpadding=""0"" cellspacing=""0"" border=""0"" align=""center""><tr>"
for j=0 to Ubound(sqlPic,2)
if sqlPic(22,j) then
LinkUrl=Cl.WebDir & sqlPic(23,j)
else
LinkUrl=Cl.WebDir & sqlPic(2,j) & "/ShowInfo.asp?InfoID=" & sqlPic(0,j)
end if
strPic = strPic & "<td align=""center"">"
FileType=right(lcase(sqlPic(14,j)),3)
strPic = strPic & "<a href=""" & LinkUrl & """ title=""" & sqlPic(4,j) & """ target=""_blank"">"
sqlPic(14,j)=Cl.ReplaceDir(sqlPic(14,j))
Select Case FileType
Case "swf"
strPic = strPic & "<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"" width=""" & ImgWidth & """ height=""" & ImgHeight & """><param name=""movie"" value=""" & sqlPic(14,j) & """><param name=""quality"" value=""high""><embed src=""" & sqlPic(14,j) & """ pluginspage=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"" type=""application/x-shockwave-flash"" width=""" & ImgWidth & """ height=""" & ImgHeight & """></embed></object>"
Case "jpg", "bmp", "png", "gif"
strPic = strPic & "<img src=""" & sqlPic(14,j) & """ width=""" & ImgWidth & """ height=""" & ImgHeight & """ border=""0"">"
Case else
strPic = strPic & "<img src=""" & Cl.WebDir & "images/NoPic.gif"" width=""" & ImgWidth & """ height=""" & ImgHeight & """ border=""0"">"
end Select
strPic = strPic & "</a></td>"
if (j+1) Mod Cols=0 then strPic = strPic & "</tr><tr valign=""top"">"
Next
strPic = strPic & "</tr></table>"
Case 1
strPic = "<table width=""100%"" cellpadding=""0"" cellspacing=""0"" border=""0"" align=""center""><tr>"
for j=0 to Ubound(sqlPic,2)
if sqlPic(22,j) then
LinkUrl=Cl.WebDir & sqlPic(23,j)
else
LinkUrl=Cl.WebDir & sqlPic(2,j) & "/ShowInfo.asp?InfoID=" & sqlPic(0,j)
end if
strPic = strPic & "<td align=""center"">"
FileType=right(lcase(sqlPic(14,j)),3)
TitleStr=Cl.GotTopic(sqlPic(4,j),TitleLen)
strPic = strPic & "<a href=""" & LinkUrl & """ title=""" & sqlPic(4,j) & """ target=""_blank"">"
sqlPic(14,j)=Cl.ReplaceDir(sqlPic(14,j))
Select Case FileType
Case "swf"
strPic = strPic & "<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"" width=""" & ImgWidth & """ height=""" & ImgHeight & """><param name=""movie"" value=""" & sqlPic(14,j) & """><param name=""quality"" value=""high""><embed src=""" & sqlPic(14,j) & """ pluginspage=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"" type=""application/x-shockwave-flash"" width=""" & ImgWidth & """ height=""" & ImgHeight & """></embed></object>"
Case "jpg", "bmp", "png", "gif"
strPic = strPic & "<img src=""" & sqlPic(14,j) & """ width=""" & ImgWidth & """ height=""" & ImgHeight & """ border=""0"">"
Case else
strPic = strPic & "<img src=""" & Cl.WebDir & "images/NoPic.gif"" width=""" & ImgWidth & """ height=""" & ImgHeight & """ border=""0"">"
end Select
strPic = strPic & "<br />" & TitleStr & "</a>"
strPic = strPic & "</td>"
if (j+1) Mod Cols=0 then strPic = strPic & "</tr><tr valign=""top"">"
Next
strPic = strPic & "</tr></table>"
Case 2
strPic = "<table width=""100%"" cellpadding=""0"" cellspacing=""0"" border=""0"" align=""center""><tr>"
for j=0 to Ubound(sqlPic,2)
if sqlPic(22,j) then
LinkUrl=Cl.WebDir & sqlPic(23,j)
else
LinkUrl=Cl.WebDir & sqlPic(2,j) & "/ShowInfo.asp?InfoID=" & sqlPic(0,j)
end if
strPic = strPic & "<td align=""center"">"
FileType=right(lcase(sqlPic(14,j)),3)
TitleStr=Cl.GotTopic(sqlPic(4,j),TitleLen)
strPic = strPic & "<a href=""" & LinkUrl & """ title=""" & sqlPic(4,j) & """ target=""_blank"">"
sqlPic(14,j)=Cl.ReplaceDir(sqlPic(14,j))
Select Case FileType
Case "swf"
strPic = strPic & "<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"" width=""" & ImgWidth & """ height=""" & ImgHeight & """><param name=""movie"" value=""" & sqlPic(14,j) & """><param name=""quality"" value=""high""><embed src=""" & sqlPic(14,j) & """ pluginspage=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"" type=""application/x-shockwave-flash"" width=""" & ImgWidth & """ height=""" & ImgHeight & """></embed></object>"
Case "jpg", "bmp", "png", "gif"
strPic = strPic & "<img src=""" & sqlPic(14,j) & """ width=""" & ImgWidth & """ height=""" & ImgHeight & """ border=""0"">"
Case else
strPic = strPic & "<img src=""" & Cl.WebDir & "images/NoPic.gif"" width=""" & ImgWidth & """ height=""" & ImgHeight & """ border=""0"">"
end Select
strPic = strPic & "<br />" & TitleStr & "</a>"
strPic = strPic & "</td><td valign=""top"" algin=""center"" class=""left""><a href=""" & LinkUrl & """>" & left(Cl.NoHtml(sqlPic(18,j)),ContentLen) & "……</a></td>"
if (j+1) Mod Cols=0 then strPic = strPic & "</tr><tr valign=""top"">"
Next
strPic = strPic & "</tr></table>"
Case 3, 4
Dim sImgID,FirstPicUrl
sImgID=Cl.CreatePass(3) & "Cl" & ImgWidth & ImgHeight & ContentLen' & IsHot & IsElite
strPic = "<script type=""text/javascript"">" & vbcrlf
strPic = strPic & "<!--" & vbcrlf
strPic = strPic & "var AImg"&sImgID&"=new Array();" & vbcrlf
strPic = strPic & "var AImg"&sImgID&"link=new Array();" & vbcrlf
strPic = strPic & "var AImg"&sImgID&"title=new Array();" & vbcrlf
strPic = strPic & "var adNum"&sImgID&"=0;" & vbcrlf
For j=0 to Ubound(sqlPic,2)
if j=0 then FirstPicUrl=Cl.ReplaceDir(sqlPic(14,j))
TitleStr = Cl.GotTopic(sqlPic(4,j),TitleLen)
'TitleStr = Cl.GetTitleFont(TitleStr,sqlPic(9,j))
'TitleStr = Cl.FormatColor(TitleStr,sqlPic(8,j))
if CBool(sqlPic(22,j)) then
LinkUrl=Cl.WebDir & sqlPic(23,j)
else
LinkUrl=Cl.WebDir & sqlPic(2,j) & "/ShowInfo.asp?InfoID=" & sqlPic(0,j)
end if
strPic = strPic & "AImg"&sImgID&"link[" & cStr(j) & "]=""" & LinkUrl & """;" & vbcrlf
strPic = strPic & "AImg"&sImgID&"[" & cStr(j) & "]=""" & Cl.ReplaceDir(Cl.GetPicUrl(sqlPic(14,j))) & """;" & vbcrlf
strPic = strPic & "AImg"&sImgID&"title[" & cStr(j) & "]=""" & Replace(TitleStr,Chr(34),"\" & Chr(34)) & """;" & vbcrlf
Next
strPic = strPic & "var preloadimg"&sImgID&"=new Array();" & vbcrlf
strPic = strPic & "for (i=1;i<AImg"&sImgID&".length;i++){preloadimg"&sImgID&"[i]=new Image();preloadimg"&sImgID&"[i].src=AImg"&sImgID&"[i];}" & vbcrlf
strPic = strPic & "function set"&sImgID&"Transition(){" & vbcrlf
strPic = strPic & "if (document.all){AImg"&sImgID&"rotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);AImg"&sImgID&"rotator.filters.revealTrans.apply();}" & vbcrlf
strPic = strPic & "}" & vbcrlf
strPic = strPic & "function play"&sImgID&"Transition(){" & vbcrlf
strPic = strPic & "if (document.all)AImg"&sImgID&"rotator.filters.revealTrans.play()" & vbcrlf
strPic = strPic & "}" & vbcrlf
strPic = strPic & "function next"&sImgID&"Img(){" & vbcrlf
strPic = strPic & "if(adNum"&sImgID&"<AImg"&sImgID&".length-1)adNum"&sImgID&"++ ;" & vbcrlf
strPic = strPic & "else adNum"&sImgID&"=0;" & vbcrlf
strPic = strPic & "set"&sImgID&"Transition();" & vbcrlf
strPic = strPic & "document.images.AImg"&sImgID&"rotator.src=AImg"&sImgID&"[adNum"&sImgID&"];" & vbcrlf
strPic = strPic & "play"&sImgID&"Transition();" & vbcrlf
if ShowType=4 then
strPic = strPic & "document.getElementById('title"&sImgID&"').innerHTML=""<a href='"" + AImg"&sImgID&"link[adNum"&sImgID&"] + ""'>"" + AImg"&sImgID&"title[adNum"&sImgID&"] +""</a>"";" & vbcrlf
End if
strPic = strPic & "theTimer=setTimeout(""next"&sImgID&"Img()"", 5000);" & vbcrlf
strPic = strPic & "}" & vbcrlf
strPic = strPic & "function jump2"&sImgID&"url(){" & vbcrlf
strPic = strPic & "jumpUrl=AImg"&sImgID&"link[adNum"&sImgID&"];jumpTarget=""_blank"";" & vbcrlf
strPic = strPic & "if (jumpUrl != ''){" & vbcrlf
strPic = strPic & "if (jumpTarget != '')window.open(jumpUrl,jumpTarget);" & vbcrlf
strPic = strPic & "else location.href=jumpUrl;" & vbcrlf
strPic = strPic & "}" & vbcrlf
strPic = strPic & "}" & vbcrlf
strPic = strPic & "function display"&sImgID&"Msg(){" & vbcrlf
strPic = strPic & "status=AImg"&sImgID&"link[adNum"&sImgID&"];" & vbcrlf
strPic = strPic & "document.returnValue = true;" & vbcrlf
strPic = strPic & "}" & vbcrlf
strPic = strPic & "//-->" & vbcrlf
strPic = strPic & "</script>" & vbcrlf
strPic = strPic & "<div class=""infopic""><a onmouseover=""display"&sImgID&"Msg();return document.returnValue;"" href=""javascript:jump2"&sImgID&"url();""><img style=""filter: revealTrans(duration=2,transition=20)"" width=""" & ImgWidth & """ height=""" & ImgHeight & """ border=""0"" src=""" & FirstPicUrl & """ name=""AImg"&sImgID&"rotator"" alt="""" /></a></div>" & vbcrlf
if ShowType=4 then
strPic = strPic & "<div class=""infotitle"" id=""title"&sImgID&"""></div>" & vbcrlf
strPic = strPic & "<script type=""text/javascript"">document.getElementById('title"&sImgID&"').innerHTML=""<a href='"" + AImg"&sImgID&"link[0] + ""'>"" + AImg"&sImgID&"title[0] +""</a>"";setTimeout(""next"&sImgID&"Img()"", 3000);</script>"
Else
strPic = strPic & "<script type=""text/javascript"">setTimeout(""next"&sImgID&"Img()"", 3000);</script>"
end if
Case 5, 6
strPic = "<script type=""text/javascript"">" & vbcrlf
strPic = strPic & "<!--" & vbcrlf
'strPic = strPic & "if (navigator.appName == ""Netscape""){" & vbcrlf
'strPic = strPic & "document.write('<a href="""&Cl.WebDir & sqlPic(2,j) & "/ShowInfo.asp?InfoID=" & sqlPic(0,j)&"""><img src="""&Cl.ReplaceDir(sqlPic(18,j))&""" width=""" & ImgWidth & """ height=""" & ImgHeight & """ border=""0"">')" & vbcrlf
'if ShowType=6 Then
'strPic = strPic & "document.write('<br />"&Cl.GotTopic(sqlPic(4,j),TitleLen)&"</a>')" & vbcrlf
'End If
'strPic = strPic & "document.write('</a>')" & vbcrlf
'strPic = strPic & "}" & vbcrlf
'strPic = strPic & "else" & vbcrlf
'strPic = strPic & "{" & vbcrlf
strPic = strPic & "var textcolor='0X000000';" '文字颜色(0xFFFFFF)
strPic = strPic & "var bgcolor='0xFFCCCC';" '文字背景颜色(0xFF6600)
strPic = strPic & "var bgalpha=10;" '文字背景颜色透明度:0-100值,0表示全部透明(60)
strPic = strPic & "var bgposition=2;" '文字位置:0顶端,1底部,2顶端浮动(0)
strPic = strPic & "var btncolor='0x256F96';" '按键颜色(0xFF6600)
strPic = strPic & "var btnncolor='0xFFFF00';" '按键当前颜色(0x000033)
strPic = strPic & "var autotime=3;" '自动播放时间(8)
strPic = strPic & "var tween=3;" '图片过渡效果:0亮度,1透明度,2模糊,3运动模糊(2)
strPic = strPic & "var swfwidth=" & Imgwidth & ";var swfheight=" & ImgHeight & ";"
strPic = strPic & "var pics='';var links='';var texts='';var flashvar='';" & vbcrlf
for j=0 to Ubound(sqlPic,2)
If j>0 Then strPic = strPic & "pics += '|';links += '|';texts += '|';"
if CBool(sqlPic(22,j)) then
LinkUrl = Cl.WebDir & sqlPic(23,j)
else
LinkUrl = Cl.WebDir & sqlPic(2,j) & "/ShowInfo.asp?InfoID=" & sqlPic(0,j)
end if
TitleStr = Replace(Cl.GotTopic(sqlPic(4,j),TitleLen),"'","\'")
strPic = strPic & "pics += '" & Cl.ReplaceDir(Cl.GetPicUrl(sqlPic(14,j))) & "';links += '" & LinkUrl & "';texts += '" & TitleStr & "';" & vbcrlf
Next
if ShowType=5 Then strPic = strPic & "texts='';"
strPic = strPic & "flashvar='bcastr_file='+pics+'&bcastr_link='+links+'&bcastr_title='+texts;"
strPic = strPic & "flashvar+='&TitleTextColor='+textcolor+'&TitleBgColor='+bgcolor;"
strPic = strPic & "flashvar+='&TitleBgAlpha='+bgalpha+'&TitleBgPosition='+bgposition;"
strPic = strPic & "flashvar+='&BtnDefaultColor='+btncolor+'&BtnOverColor='+btnncolor;"
strPic = strPic & "flashvar+='&AutoPlayTime='+autotime+'&Tween='+tween;" & vbcrlf
strPic = strPic & "document.write('<object classid=""clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"" codebase=""http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"" width=""'+ swfwidth +'"" height=""'+ swfheight +'"">');" & vbcrlf
strPic = strPic & "document.write('<param name=""movie"" value=""" & InstallDir & "Images/Bcastr31.swf""><param name=""quality"" value=""high"">');" & vbcrlf
strPic = strPic & "document.write('<param name=""menu"" value=""false""><param name=""wmode"" value=""opaque"">');" & vbcrlf
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -