| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 415 人关注过本帖
标题:求助首页幻灯显示修改
只看楼主 加入收藏
飞在伊犁
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-11-10
收藏
 问题点数:0 回复次数:1 
求助首页幻灯显示修改
请教高手,如何将以下图片显示程序改为幻灯显示
首页调用语名
<% call ShowPicArticle(0,1,10,1,1,310,240,200,true,false) %>
图片调用函数
'=================================================
'过程名:ShowPicArticle
'作  用:显示图片文章
'参  数:intClassID  ----栏目ID,0为所有栏目,若大于0,则显示指定栏目及其子栏目的图片文章
'        ArticleNum  ----最多显示多少篇文章
'        TitleLen   ----标题最多字符数,一个汉字=两个英文字符
'        ShowType   ----显示方式。1为只有图片+标题,2为图片+标题+内容简介
'        Cols       ----列数。超过此列数就换行。
'        ImgWidth   ----图片宽度
'        ImgHeight  ----图片高度
'        ContentLen ----内容最多字符数
'        Hot        ----是否是热门文章
'        Elite      ----是否是推荐文章
'=================================================
sub ShowPicArticle(intClassID,ArticleNum,TitleLen,ShowType,Cols,ImgWidth,ImgHeight,ContentLen,Hot,Elite)
    dim sqlPic,i,tClass,trs,arrClassID
    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=conn.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=conn.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>=" & HitsOfHot
    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=Server.CreateObject("ADODB.Recordset")
    rsPic.open sqlPic,conn,1,1
    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>"
    response.write strPic
    rsPic.close
end sub
搜索更多相关主题的帖子: 首页 幻灯 
2010-11-10 11:01
飞在伊犁
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-11-10
收藏
得分:0 
怎么没人应啊
没有高手愿意指点吗
2010-11-15 13:24
快速回复:求助首页幻灯显示修改
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.051854 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved