您现在的位置: 阿标在线 >> 技术文章 >> 本站作品 >> 动力3.62相关 >> 正文

最新图片文章横向移动的修改 for  3.62

[ 录入:chinar | 点击数: | 更新时间:2005-8-7 13:00:00]

在文件inc/syscode_article.asp   中找到过程ShowPicArticle直接替换为以下代码

'=================================================
'过程名:ShowPicArticle
'作  用:显示图片文章
'参  数:intClassID  ----栏目ID,0为所有栏目,若大于0,则显示指定栏目及其子栏目的图片文章
'        ArticleNum  ----最多显示多少篇文章
'        TitleLen   ----标题最多字符数,一个汉字=两个英文字符
'        ShowType   ----显示方式。1为只有图片+标题,2为图片+标题+内容简介
'        Cols       ----列数。超过此列数就换行。
'        ImgWidth   ----图片宽度
'        ImgHeight  ----图片高度
'        ContentLen ----内容最多字符数
'        Hot        ----是否是热门文章
'        Elite      ----是否是推荐文章
'=================================================
function ShowPicArticle(intClassID,ArticleNum,TitleLen,ShowType,Cols,ImgWidth,ImgHeight,ContentLen,Hot,Elite)
dim sqlPic,i,tClass,trs,arrClassID
strPic=""
strPic=strPic &  "<table width=""100%"" border=""0"" cellpadding=""3"" cellspacing=""0"">"
strPic=strPic &  "              <tr> "
strPic=strPic &  "                <td align=""center"" valign=""middle""> "
strPic=strPic &  "                <div id=demo style=overflow:hidden;height:135;width:100%;><table align=left cellpadding=0 cellspace=0 border=0><tr><td id=demo1 valign=top>"
if ArticleNum<0 or ArticleNum>=50 then
  ArticleNum=5
end if
if ShowType<>1 and ShowType<>2 then
  ShowType=1
end if
if Cols<=0 or Cols>=10 then
  Cols=5
end if
if ImgWidth<0 or ImgWidth>500 then
  ImgWidth=150
end if
if ImgHeight<0 or ImgHeight>500 then
  ImgHeight=150
end if
if Hot<>True and Hot<>False then
  Hot=False
end if
if Elite<>True and Elite<>False then
  Elite=False
end if

sqlPic="select top " & ArticleNum
sqlPic=sqlPic & " A.ArticleID,A.ClassID,L.LayoutID,L.LayoutFileName,A.Title,A.Key,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.TitleFontColor,A.TitleFontType,"
if ShowType=2 then
  sqlPic=sqlPic & "A.Content,"
end if
sqlPic=sqlPic & " A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Article A"
sqlPic=sqlPic & " inner join Layout L on A.LayoutID=L.LayoutID where A.Deleted=False and A.Passed=True and DefaultPicUrl<>''"

if intClassID>0 then
  set tClass=nt2003.execute("select ClassID,Child,ParentPath from ArticleClass where ClassID=" & intClassID)
  if not(tClass.bof and tClass.eof) then
   if tClass(1)>0 then
    arrClassID=ClassID
    set trs=nt2003.execute("select ClassID from ArticleClass where ParentID=" & tClass(0) & " or ParentPath like '%" & tClass(2) & "," & tClass(0) & ",%' and Child=0 and LinkUrl=''")
    do while not trs.eof
     arrClassID=arrClassID & "," & trs(0)
     trs.movenext
    loop
    set trs=nothing
    sqlPic=sqlPic & " and A.ClassID in (" & arrClassID & ")"
   else
    sqlPic=sqlPic & " and A.ClassID=" & tClass(0)
   end if
   set trs=nothing
  else
   sqlPic=sqlPic & " and A.ClassID=" & tClass(0)
  end if
  set tClass=nothing
end if
if Hot=True then
  sqlPic=sqlPic & " and A.Hits>=" & nt2003.site_setting(14)
end if
if Elite=True then
  sqlPic=sqlPic & " and A.Elite=True "
end if
sqlPic=sqlPic & " order by A.OnTop,A.ArticleID desc"
set rsPic=nt2003.Execute(sqlPic)
strPic=strPic &  "<table width='100%' cellpadding='0' cellspacing='5' border='0' align='center'><tr valign='top'>"
if rsPic.bof and rsPic.eof then
  strPic= strPic & "<td align='center'><img src='images/NoPic.jpg' width='" & ImgWidth & "' height='" & ImgHeight & "' border='0'><br>没有任何图片文章</td>"
else
  i=0
  if ShowType=1 then
   do while not rsPic.eof
    strPic=strPic & "<td align='center'>"
    call GetPicArticleTitle(TitleLen,ImgWidth,ImgHeight)
    strPic=strPic & "</td>"
    rsPic.movenext
    i=i+1
    if ((i mod Cols=0) and (not rsPic.eof)) then strPic=strPic & "</tr><tr valign='top'>"
   loop
  elseif ShowType=2 then
   do while not rsPic.eof
    strPic=strPic & "<td align='center'>"
    call GetPicArticleTitle(TitleLen,ImgWidth,ImgHeight)
    strPic=strPic & "</td><td valign='top' algin='center' class='left'><a href='" & rsPic("LayoutFileName") & "?ArticleID=" & rsPic("ArticleID") & "'>" & left(nohtml(rsPic("Content")),ContentLen) & "……</a></td>"
    rsPic.movenext
    i=i+1
    if ((i mod Cols=0) and (not rsPic.eof)) then strPic=strPic & "</tr><tr valign='top'>"
   loop
  end if
  
end if
strPic=strPic &  "</tr></table>"
rsPic.close
strPic=strPic &  "</td><td id=demo2 valign=top></td></tr></table></div>"
    strPic=strPic &  "<script>"& vbcrlf
    strPic=strPic &  "var speed=15" & vbcrlf
    strPic=strPic &  "   demo2.innerHTML=demo1.innerHTML"& vbcrlf
     strPic=strPic &  "  function Marquee(){"& vbcrlf
    strPic=strPic &  "   if(demo2.offsetWidth-demo.scrollLeft<=0)"& vbcrlf
    strPic=strPic &  "   demo.scrollLeft-=demo1.offsetWidth"& vbcrlf
    strPic=strPic &  "   else{"& vbcrlf
    strPic=strPic &  "   demo.scrollLeft++"& vbcrlf
    strPic=strPic &  "   }"& vbcrlf
    strPic=strPic &  "   }"& vbcrlf
    strPic=strPic &  "   var MyMar=setInterval(Marquee,speed)"& vbcrlf
    strPic=strPic &  "   demo.onmouseover=function() {clearInterval(MyMar)}"& vbcrlf
    strPic=strPic &  "   demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}"& vbcrlf
    strPic=strPic &  "   </script>"& vbcrlf
   strPic=strPic &  "   </td> </tr></table>"
ShowPicArticle=strPic
end function

'=================================================
'过程名:GetPicArticleTitle
'作  用:显示图片文章的标题
'参  数:intTitleLen  ----标题最多字符数,一个汉字=两个英文字符
'        intImgWidth   ----图片宽度
'        intImgHeight  ----图片高度
'=================================================
sub GetPicArticleTitle(intTitleLen,intImgWidth,intImgHeight)
dim FileType,TitleStr
FileType=right(lcase(rsPic("DefaultPicUrl")),3)
TitleStr=gotTopic(rsPic("Title"),intTitleLen)
strPic=strPic &  "<table border='0' cellspacing='0' cellpadding='0' align='center'><tr><td height='10'><img src='Images/bg_0ltop.gif' width='10' height='10'></td><td height='10' background='Images/bg_01.gif'></td><td height='10'><img src='Images/bg_0rtop.gif' width='10' height='10'></td></tr><tr><td width=10 background=Images/bg_03.gif>&nbsp;</td><td align='center' valign='middle' bgcolor='#FFFFFF'>"
             strPic=strPic & "<a href='" & rsPic("LayoutFileName") & "?ArticleID=" & rsPic("ArticleID") & "' title='文章标题:" & rsPic("Title") & vbcrlf & "文章作者:" & rsPic("Author") & vbcrlf & "更新时间:" & rsPic("UpdateTime") & vbcrlf & "点击次数:" & rsPic("Hits") & "' target='_blank'>"
if FileType="swf" then
  strPic=strPic & "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase=' elseif fileType="jpg" or fileType="bmp" or fileType="png" or fileType="gif" then
  strPic=strPic & "<img src='" & rsPic("DefaultPicUrl") & "' width='" & intImgWidth & "' height='" & intImgHeight & "' border='0' >"
else
  strPic=strPic & "<img src='images/NoPic2.jpg' width='" & intImgWidth & "' height='" & intImgHeight & "' border='0'>"
end if
strPic=strPic & "</a></td><td width='10' background='Images/bg_04.gif'>&nbsp;</td></tr><tr><td height='10'><img src='Images/bg_0lbottom.gif' width='10' height='10'></td><td height='10' background='Images/bg_02.gif'></td><td height='10'><img src='Images/bg_0rbottom.gif' width='10' height='10'></td></tr></table>"
strPic=strPic & "<a href='" & rsPic("LayoutFileName") & "?ArticleID=" & rsPic("ArticleID") & "' title='文章标题:" & rsPic("Title") & vbcrlf & "文章作者:" & rsPic("Author") & vbcrlf & "更新时间:" & rsPic("UpdateTime") & vbcrlf & "点击次数:" & rsPic("Hits") & "' target='_blank'>"

if rsPic("TitleFontType")=1 then
  TitleStr="<b>" & TitleStr & "</b>"
elseif rsPic("TitleFontType")=2 then
  TitleStr="<em>" & TitleStr & "</em>"
elseif rsPic("TitleFontType")=3 then
  TitleStr="<b><em>" & TitleStr & "</em></b>"
end if
if rsPic("TitleFontColor")<>"" then
  TitleStr="<font color='" & rsPic("TitleFontColor") & "'>" & TitleStr & "</font>"
end if
strPic=strPic & TitleStr & "</a>"
end sub



  • 上一篇文章:

  • 下一篇文章: