当前位置:首页 > ASP教程 > ASP类

文章列表类别

<%
dim html
set html = new newasppublic_cls
class newasppublic_cls

    private sub class_initialize()
        on error resume next
        newasp.loadtemplates 0, 0, 0
    end sub
    '================================================
    '函数名:loadarticlelist
    '作  用:装载文章列表
    '参  数:classid   ----分类id
    '        channelid   ----频道id
    '        specialid  ----专题id
    '        stype   ----调用文章类型,0=所有最新文章,1=推荐文章,2=热门文章,3=图文文章,4=分类最新文章
    '        topnum   ----显示文章列表数
    '        strlen   ----显示标题长度
    '        showclass   ----是否显示分类
    '        showpic   ----是否显示图文标题
    '        showdate   ----是否显示日期
    '        datemode   ----显示日期模式
    '        newindow   ----新窗口打开
    '================================================
    public function loadarticlelist(byval channelid, byval classid, byval specialid, _
        byval stype, byval topnum, byval strlen, _
        byval showclass, byval showpic, byval showdate, _
        byval datemode, byval newindow, byval styles)

        dim rs, sql, i, strcontent, foundstr
        dim stitle, stopic, childstr, liststyle, bestcode, beststring
        dim articletopic, classname, htmlfileurl, writetime, linktarget, htmlfilename

        channelid = newasp.chknumeric(channelid)
        classid = newasp.chknumeric(classid)
        specialid = newasp.chknumeric(specialid)
        stype = newasp.chknumeric(stype)

        on error resume next
        newasp.loadchannel(channelid)

        if cint(stype) >= 4 and clng(classid) <> 0 then
            sql = "select childstr from [nc_classify] where channelid=" & channelid & " and classid=" & classid
            set rs = newasp.execute(sql)
            if rs.bof and rs.eof then
                set rs = nothing
                loadarticlelist = ""
                exit function
            else
                childstr = rs("childstr")
            end if
            set rs = nothing
        else
            childstr = "0"
        end if

        select case cint(stype)
            case 0: foundstr = "order by a.writetime desc ,a.articleid desc"
            case 1: foundstr = "and a.isbest > 0 order by a.writetime desc ,a.articleid desc"
            case 2: foundstr = "order by a.allhits desc ,a.articleid desc"
            case 3: foundstr = "and (a.brieftopic = 1 or a.brieftopic = 2) order by a.writetime desc ,a.articleid desc"
            case 4: foundstr = "and a.classid in (" & childstr & ") order by a.writetime desc ,a.articleid desc"
            case 5: foundstr = "and a.classid in (" & childstr & ") and a.isbest > 0 order by a.writetime desc ,a.articleid desc"
            case 6: foundstr = "and a.classid in (" & childstr & ") order by a.allhits desc ,a.articleid desc"
            case 7: foundstr = "and a.classid in (" & childstr & ") and (a.brieftopic = 1 or a.brieftopic = 2) order by a.writetime desc ,a.articleid desc"
        case else
            foundstr = "order by a.writetime desc ,a.articleid desc"
        end select
        if cint(stype) >= 4 and clng(classid) = 0 then
            foundstr = "order by a.writetime desc ,a.articleid desc"
        end if
        if clng(specialid) <> 0 then
            foundstr = "and a.specialid =" & clng(specialid) & " " & foundstr
        end if
        sql = " a.articleid,a.classid,a.colormode,a.fontmode,a.title,a.brieftopic,a.allhits,a.writetime,a.htmlfiledate,a.isbest,"
        sql = "select top " & cint(topnum) & sql & " c.classname,c.colormodes,c.fontmodes,c.htmlfiledir,c.usehtml from [nc_article] a inner join [nc_classify] c on a.classid=c.classid where a.isaccept>0 and a.channelid=" & channelid & " " & foundstr & ""
        set rs = newasp.execute(sql)
        i = 0
        if rs.bof and rs.eof then
            strcontent = "该分类还没有添加任何内容!"
        else
            strcontent = "<table width=""100%"" border=0 cellpadding=2 cellspacing=0>"
            do while not rs.eof
                if (i mod 2) = 0 then
                    liststyle = trim(styles) & 1
                else
                    liststyle = trim(styles) & 2
                end if
                if rs("isbest") <> 0 then
                    bestcode = 2
                    beststring = "<font color='" & newasp.mainsetting(3) & "'>推荐</font>"
                else
                    bestcode = 1
                    beststring = ""
                end if

                strcontent = strcontent & newasp.mainsetting(13)

                stitle = newasp.gottopic(rs("title"), cint(strlen))
                stitle = newasp.readfontmode(stitle, rs("colormode"), rs("fontmode"))
                stopic = newasp.readpictopic(rs("brieftopic"))

                classname = newasp.readfontmode(rs("classname"), rs("colormodes"), rs("fontmodes"))
                htmlfilename = newasp.readfilename(rs("htmlfiledate"), rs("articleid"), newasp.channelhtmlext, newasp.channelprefix, newasp.channelhtmlform, "")
                if cint(newasp.channelusehtml) <> 0 then
                    htmlfileurl = newasp.channelpath & rs("htmlfiledir") & newasp.showdatepath(rs("htmlfiledate"), newasp.channelhtmlpath) & htmlfilename
                    classname = "<a href='" & newasp.channelpath & rs("htmlfiledir") & "index" & newasp.channelhtmlext & "'>" & classname & "</a>"
                else
                    htmlfileurl = newasp.channelpath & "show.asp?id=" & rs("articleid")
                    classname = "<a href='" & newasp.channelpath & "list.asp?classid=" & rs("classid") & "'>" & classname & "</a>"
                end if

                if cint(showclass) = 0 then classname = ""
                if cint(showpic) = 0 then stopic = ""
                if cint(showdate) <> 0 then
                    writetime = newasp.showdatetime(rs("writetime"), cint(datemode))
                else
                    writetime = ""
                end if
                if cint(newindow) <> 0 then
                    linktarget = " target=""_blank"""
                else
                    linktarget = ""
                end if
                articletopic = "<a href='" & htmlfileurl & "'" & linktarget & " title='" & newasp.channelmodule & "标题:" & rs("title") & " 发布时间:" & rs("writetime") & " 阅览次数:" & rs("allhits") & "' class=showlist>" & stitle & "</a>"
                strcontent = replace(strcontent, "{$articletopic}", articletopic)
                strcontent = replace(strcontent, "{$articleid}", rs("articleid"))
                strcontent = replace(strcontent, "{$installdir}", newasp.installdir)
                strcontent = replace(strcontent, "{$articletitle}", stitle)
                strcontent = replace(strcontent, "{$title}", rs("title"))
                strcontent = replace(strcontent, "{$dateandtitle}", rs("writetime"))
                strcontent = replace(strcontent, "{$brieftopic}", stopic)
                strcontent = replace(strcontent, "{$htmlfileurl}", htmlfileurl)
                strcontent = replace(strcontent, "{$classname}", classname)
                strcontent = replace(strcontent, "[]", "")
                strcontent = replace(strcontent, "{$target}", linktarget)
                strcontent = replace(strcontent, "{$writetime}", writetime)
                strcontent = replace(strcontent, "{$aticlehits}", rs("allhits"))
                strcontent = replace(strcontent, "{$liststyle}", liststyle)
                strcontent = replace(strcontent, "{$bestcode}", bestcode)
                strcontent = replace(strcontent, "{$beststring}", beststring)
            rs.movenext
            i = i + 1
            loop
            strcontent = strcontent & "</table>"
        end if

        rs.close: set rs = nothing
        loadarticlelist = strcontent
    end function
    '================================================
    '函数名:readarticlelist
    '作  用:读取文章列表
    '参  数:str ----原字符串
    '================================================
    public function readarticlelist(byval str)
        dim strtemp, i
        dim stempcontent, ntempcontent
        dim arrtempcontent, arrtempcontents, arraylist
        on error resume next
        strtemp = str
        if instr(strtemp, "{$readarticlelist(") > 0 then
            stempcontent = newasp.cutmatchcontent(strtemp, "{$readarticlelist(", ")}", 1)
            ntempcontent = newasp.cutmatchcontent(strtemp, "{$readarticlelist(", ")}", 0)
            arrtempcontents = split(stempcontent, "|||")
            arrtempcontent = split(ntempcontent, "|||")

            for i = 0 to ubound(arrtempcontents)
                arraylist = split(arrtempcontent(i), ",")
                strtemp = replace(strtemp, arrtempcontents(i), loadarticlelist(arraylist(0), arraylist(1), arraylist(2), arraylist(3), arraylist(4), arraylist(5), arraylist(6), arraylist(7), arraylist(8), arraylist(9), arraylist(10), arraylist(11)))
            next
        end if
        readarticlelist = strtemp
    end function
    '================================================
    '函数名:loadsoftlist
    '作  用:装载软件列表
    '参  数:classid   ----分类id
    '        channelid   ----频道id
    '        stype   ----调用类型
    '        topnum   ----显示列表数
    '        strlen   ----显示标题长度
    '        showclass   ----是否显示分类
    '        showdate   ----是否显示日期
    '        datemode   ----显示日期模式
    '        newindow   ----新窗口打开
    '================================================
    public function loadsoftlist(byval channelid, byval classid, byval specialid, _
        byval stype, byval topnum, byval strlen, byval showclass, _
        byval showdate, byval datemode, byval newindow, byval styles)

        dim rs, sql, i, strcontent, foundstr,j
        dim strsoftname, childstr, liststyle
        dim htmlfilename, bestcode, beststring,channelpath
        dim classname, htmlfileurl, softtime, linktarget, softtopic

        channelid = newasp.chknumeric(channelid)
        classid = newasp.chknumeric(classid)
        specialid = newasp.chknumeric(specialid)
        stype = newasp.chknumeric(stype)

        on error resume next
        newasp.loadchannel(channelid)

        if cint(stype) >= 3 and clng(classid) <> 0 then
            sql = "select childstr from [nc_classify] where channelid=" & channelid & " and classid = " & classid
            set rs = newasp.execute(sql)
            if rs.bof and rs.eof then
                set rs = nothing
                loadsoftlist = ""
                exit function
            else
                childstr = rs("childstr")
            end if
            rs.close
        else
            childstr = 0
        end if
        select case cint(stype)
            case 0: foundstr = "order by a.softtime desc ,a.softid desc"
            case 1: foundstr = "and a.isbest > 0 order by a.softtime desc ,a.softid desc"
            case 2: foundstr = "order by a.allhits desc ,a.softid desc"
            case 3: foundstr = "and a.classid in (" & childstr & ") order by a.softtime desc ,a.softid desc"
            case 4: foundstr = "and a.classid in (" & childstr & ") and a.isbest > 0 order by a.softtime desc ,a.softid desc"
            case 5: foundstr = "and a.classid in (" & childstr & ") order by a.allhits desc ,a.softid desc"
        case else
            foundstr = "order by a.softtime desc ,a.softid desc"
        end select
        if cint(stype) >= 3 and clng(classid) = 0 then
            foundstr = "order by a.softtime desc ,a.softid desc"
        end if
        if clng(specialid) <> 0 then
            foundstr = "and a.specialid =" & clng(specialid) & " " & foundstr
        end if
        sql = " a.softid,a.classid,a.colormode,a.fontmode,a.softname,a.softver,a.allhits,a.softtime,a.htmlfiledate,a.isbest,"
        sql = "select top " & cint(topnum) & sql & " c.classname,c.colormodes,c.fontmodes,c.htmlfiledir,c.usehtml from [nc_softlist] a inner join [nc_classify] c on a.classid=c.classid where a.isaccept>0 and a.channelid=" & channelid & " " & foundstr & ""
        set rs = newasp.execute(sql)
        j = 0

        if rs.bof and rs.eof then
            strcontent = "没有添加任何软件!"
        else
            sql=rs.getrows(-1)
            strcontent = "<table width=""100%"" border=0 cellpadding=2 cellspacing=0>"
            for i=0 to ubound(sql,2)
                if (j mod 2) = 0 then
                    liststyle = trim(styles) & 1
                else
                    liststyle = trim(styles) & 2
                end if
                if cint(sql(9,i)) <> 0 then
                    bestcode = 2
                    beststring = "<font color='" & newasp.mainsetting(3) & "'>推荐</font>"
                else
                    bestcode = 1
                    beststring = ""
                end if
                strcontent = strcontent & newasp.mainsetting(14)
                strsoftname = newasp.gottopic(sql(4,i) & " " & sql(5,i), cint(strlen))
                strsoftname = newasp.readfontmode(strsoftname, sql(2,i), sql(3,i))
                classname = newasp.readfontmode(sql(10,i), sql(11,i), sql(12,i))
                htmlfilename = newasp.readfilename(sql(8,i), sql(0,i), newasp.channelhtmlext, newasp.channelprefix, newasp.channelhtmlform, "")
                if cint(newasp.channelusehtml) <> 0 then
                    htmlfileurl = newasp.channelpath & sql(13,i) & newasp.showdatepath(sql(8,i), newasp.channelhtmlpath) & htmlfilename
                    classname = "<a href='" & newasp.channelpath & sql(13,i) & "index" & newasp.channelhtmlext & "'>" & classname & "</a>"
                else
                    htmlfileurl = newasp.channelpath & "show.asp?id=" & sql(0,i)
                    classname = "<a href='" & newasp.channelpath & "list.asp?classid=" & sql(1,i) & "'>" & classname & "</a>"
                end if
                if cint(showclass) = 0 then classname = ""
                if cint(showdate) <> 0 then
                    softtime = newasp.showdatetime(sql(7,i), cint(datemode))
                else
                    softtime = ""
                end if
                if cint(newindow) <> 0 then
                    linktarget = " target=""_blank"""
                else
                    linktarget = ""
                end if
                softtopic = "<a href='" & htmlfileurl & "'" & linktarget & " title='" & newasp.channelmodule & "名称:" & trim(sql(4,i) & " " & sql(5,i)) & " 发布时间:" & sql(7,i) & " 下载次数:" & sql(6,i) & "' class=showlist>" & strsoftname & "</a>"
                strcontent = replace(strcontent, "{$softtopic}", softtopic)
                strcontent = replace(strcontent, "{$softid}", rs("softid"))
                strcontent = replace(strcontent, "{$installdir}", newasp.installdir)
                strcontent = replace(strcontent, "{$softname}", strsoftname)
                strcontent = replace(strcontent, "{$title}", sql(4,i))
                strcontent = replace(strcontent, "{$dateandtitle}", sql(7,i))
                strcontent = replace(strcontent, "{$htmlfileurl}", htmlfileurl)
                strcontent = replace(strcontent, "{$classname}", classname)
                strcontent = replace(strcontent, "[]", "")
                strcontent = replace(strcontent, "{$target}", linktarget)
                strcontent = replace(strcontent, "{$softtime}", softtime)
                strcontent = replace(strcontent, "{$softhits}", sql(6,i))
                strcontent = replace(strcontent, "{$liststyle}", liststyle)
                strcontent = replace(strcontent, "{$bestcode}", bestcode)
                strcontent = replace(strcontent, "{$beststring}", beststring)
            j = j + 1
            next
            sql=null
            strcontent = strcontent & "</table>"
        end if
        rs.close: set rs = nothing
        loadsoftlist = strcontent
    end function
    '================================================
    '函数名:readsoftlist
    '作  用:读取软件列表
    '参  数:str ----原字符串
    '================================================
    public function readsoftlist(byval str)
        dim strtemp, i
        dim stempcontent, ntempcontent
        dim arrtempcontent, arrtempcontents, arraylist
        on error resume next
        strtemp = str
        if instr(strtemp, "{$readsoftlist(") > 0 then
            stempcontent = newasp.cutmatchcontent(strtemp, "{$readsoftlist(", ")}", 1)
            ntempcontent = newasp.cutmatchcontent(strtemp, "{$readsoftlist(", ")}", 0)
            arrtempcontents = split(stempcontent, "|||")
            arrtempcontent = split(ntempcontent, "|||")
            for i = 0 to ubound(arrtempcontents)
                arraylist = split(arrtempcontent(i), ",")
                strtemp = replace(strtemp, arrtempcontents(i), loadsoftlist(arraylist(0), arraylist(1), arraylist(2), arraylist(3), arraylist(4), arraylist(5), arraylist(6), arraylist(7), arraylist(8), arraylist(9), arraylist(10)))
            next
        end if
        readsoftlist = strtemp
    end function

    '================================================
    '函数名:loadflashlist
    '作  用:装载动画列表
    '参  数:classid   ----分类id
    '        channelid   ----频道id
    '        stype   ----调用类型
    '        topnum   ----显示列表数
    '        strlen   ----显示标题长度
    '        showclass   ----是否显示分类
    '        showdate   ----是否显示日期
    '        datemode   ----显示日期模式
    '        newindow   ----新窗口打开
    '================================================
    public function loadflashlist(byval channelid, byval classid, byval specialid, _
        byval stype, byval topnum, byval strlen, byval showclass, _
        byval showdate, byval datemode, byval newindow, byval styles)

        dim rs, sql, i, strcontent, foundstr,j
        dim strtitle, childstr, liststyle
        dim htmlfilename, bestcode, beststring,channelpath
        dim classname, htmlfileurl, addtime, linktarget, flashtopic

        channelid = newasp.chknumeric(channelid)
        classid = newasp.chknumeric(classid)
        specialid = newasp.chknumeric(specialid)
        stype = newasp.chknumeric(stype)

        on error resume next
        newasp.loadchannel(channelid)

        if cint(stype) >= 3 and clng(classid) <> 0 then
            sql = "select childstr from [nc_classify] where channelid=" & channelid & " and classid = " & classid
            set rs = newasp.execute(sql)
            if rs.bof and rs.eof then
                set rs = nothing
                loadflashlist = ""
                exit function
            else
                childstr = rs("childstr")
            end if
            rs.close
        else
            childstr = 0
        end if
        select case cint(stype)
            case 0: foundstr = "order by a.addtime desc ,a.flashid desc"
            case 1: foundstr = "and a.isbest > 0 order by a.addtime desc ,a.flashid desc"
            case 2: foundstr = "order by a.allhits desc ,a.flashid desc"
            case 3: foundstr = "and a.classid in (" & childstr & ") order by a.addtime desc ,a.flashid desc"
            case 4: foundstr = "and a.classid in (" & childstr & ") and a.isbest > 0 order by a.addtime desc ,a.flashid desc"
            case 5: foundstr = "and a.classid in (" & childstr & ") order by a.allhits desc ,a.flashid desc"
        case else
            foundstr = "order by a.addtime desc ,a.flashid desc"
        end select
        if cint(stype) >= 3 and clng(classid) = 0 then
            foundstr = "order by a.addtime desc ,a.flashid desc"
        end if
        if clng(specialid) <> 0 then
            foundstr = "and a.specialid =" & clng(specialid) & " " & foundstr
        end if
        sql = " a.flashid,a.classid,a.colormode,a.fontmode,a.title,a.author,a.allhits,a.addtime,a.htmlfiledate,a.isbest,"
        sql = "select top " & cint(topnum) & sql & " c.classname,c.colormodes,c.fontmodes,c.htmlfiledir,c.usehtml from [nc_flashlist] a inner join [nc_classify] c on a.classid=c.classid where a.isaccept>0 and a.channelid=" & channelid & " " & foundstr & ""
        set rs = newasp.execute(sql)
        j = 0

        if rs.bof and rs.eof then
            strcontent = "没有添加任何信息!"
        else
            sql=rs.getrows(-1)
            strcontent = "<table width=""100%"" border=0 cellpadding=2 cellspacing=0>"
            for i=0 to ubound(sql,2)
                if (j mod 2) = 0 then
                    liststyle = trim(styles) & 1
                else
                    liststyle = trim(styles) & 2
                end if
                if cint(sql(9,i)) <> 0 then
                    bestcode = 2
                    beststring = "<font color='" & newasp.mainsetting(3) & "'>推荐</font>"
                else
                    bestcode = 1
                    beststring = ""
                end if
                strcontent = strcontent & newasp.mainsetting(22)
                strtitle = newasp.gottopic(sql(4,i), cint(strlen))
                strtitle = newasp.readfontmode(strtitle, sql(2,i), sql(3,i))
                classname = newasp.readfontmode(sql(10,i), sql(11,i), sql(12,i))
                htmlfilename = newasp.readfilename(sql(8,i), sql(0,i), newasp.channelhtmlext, newasp.channelprefix, newasp.channelhtmlform, "")
                if cint(newasp.channelusehtml) <> 0 then
                    htmlfileurl = newasp.channelpath & sql(13,i) & newasp.showdatepath(sql(8,i), newasp.channelhtmlpath) & htmlfilename
                    classname = "<a href='" & newasp.channelpath & sql(13,i) & "index" & newasp.channelhtmlext & "'>" & classname & "</a>"
                else
                    htmlfileurl = newasp.channelpath & "show.asp?id=" & sql(0,i)
                    classname = "<a href='" & newasp.channelpath & "list.asp?classid=" & sql(1,i) & "'>" & classname & "</a>"
                end if
                if cint(showclass) = 0 then classname = ""
                if cint(showdate) <> 0 then
                    addtime = newasp.showdatetime(sql(7,i), cint(datemode))
                else
                    addtime = ""
                end if
                if cint(newindow) <> 0 then
                    linktarget = " target=""_blank"""
                else
                    linktarget = ""
                end if
                flashtopic = "<a href='" & htmlfileurl & "'" & linktarget & " title='" & newasp.channelmodule & "名称:" & sql(4,i) & " 发布时间:" & sql(7,i) & " 下载次数:" & sql(6,i) & "' class=showlist>" & strtitle & "</a>"
                strcontent = replace(strcontent, "{$flashtopic}", flashtopic)
                strcontent = replace(strcontent, "{$flashid}", rs("flashid"))
                strcontent = replace(strcontent, "{$installdir}", newasp.installdir)
                strcontent = replace(strcontent, "{$flashtopic}", strtitle)
                strcontent = replace(strcontent, "{$title}", sql(4,i))
                strcontent = replace(strcontent, "{$dateandtime}", sql(7,i))
                strcontent = replace(strcontent, "{$htmlfileurl}", htmlfileurl)
                strcontent = replace(strcontent, "{$classname}", classname)
                strcontent = replace(strcontent, "[]", "")
                strcontent = replace(strcontent, "{$target}", linktarget)
                strcontent = replace(strcontent, "{$addtime}", addtime)
                strcontent = replace(strcontent, "{$flashhits}", sql(6,i))
                strcontent = replace(strcontent, "{$liststyle}", liststyle)
                strcontent = replace(strcontent, "{$bestcode}", bestcode)
                strcontent = replace(strcontent, "{$beststring}", beststring)
            j = j + 1
            next
            sql=null
            strcontent = strcontent & "</table>"
        end if
        rs.close: set rs = nothing
        loadflashlist = strcontent
    end function
    '================================================
    '函数名:readflashlist
    '作  用:读取动画列表
    '参  数:str ----原字符串
    '================================================
    public function readflashlist(byval str)
        dim strtemp, i
        dim stempcontent, ntempcontent
        dim arrtempcontent, arrtempcontents, arraylist
        on error resume next
        strtemp = str
        if instr(strtemp, "{$readflashlist(") > 0 then
            stempcontent = newasp.cutmatchcontent(strtemp, "{$readflashlist(", ")}", 1)
            ntempcontent = newasp.cutmatchcontent(strtemp, "{$readflashlist(", ")}", 0)
            arrtempcontents = split(stempcontent, "|||")
            arrtempcontent = split(ntempcontent, "|||")
            for i = 0 to ubound(arrtempcontents)
                arraylist = split(arrtempcontent(i), ",")
                strtemp = replace(strtemp, arrtempcontents(i), loadflashlist(arraylist(0), arraylist(1), arraylist(2), arraylist(3), arraylist(4), arraylist(5), arraylist(6), arraylist(7), arraylist(8), arraylist(9), arraylist(10)))
            next
        end if
        readflashlist = strtemp
    end function
    '================================================
    '函数名:loadannouncecontent
    '作  用:装载内容公告
    '参  数:str ----原字符串
    '================================================
    public function loadannouncecontent(byval stopic, byval channelid)
        dim sql, rs, strtemp
        strtemp =
【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!