SoFunction
Updated on 2025-04-13

Asp common functions collection, very good research page 2/4 later


class ncmsnewstag
    public id,ty,show,len,num,lih,imgw,imgh,tgt,hit
    public function newsshow(stype,scolumn)
        dim TempHTM,xsql,rs,databox,i,imgdot,obox
            TempHTM = "" & chr(10) & "<table cellpadding=""0"" cellspacing=""0"" width=""100%"" border=""0"">" & chr(10)
            TempHTM = TempHTM & "<tr>" & chr(10)
        if tgt = "" then
            tgt = "self"
        end if
        select case stype
            case "text"
                if show = "new" then
                    if id = 0 then
                        set rs = ("select top " & num & " classid,title,isimg,filename from NCMS_news where created=1 and pagetype=0 order by id desc")
                    else
                        set rs = ("select top " & num & " classid,title,isimg,filename from NCMS_news where classid in(" & id & allchildclass(id) & ") and created=1 and pagetype=0 order by id desc")
                    end if
                elseif show = "elite" then
                    if id = 0 then
                        set rs = ("select top " & num & " classid,title,isimg,filename from NCMS_news where elite=1 and created=1 and pagetype=0 order by id desc")
                    else
                        set rs = ("select top " & num & " classid,title,isimg,filename from NCMS_news where classid in(" & id & allchildclass(id) & ") and elite=1 and created=1 and pagetype=0 order by id desc")
                    end if
                elseif show = "hot" then
                    if id = 0 then
                        set rs = ("select top " & num & " classid,title,isimg,filename from NCMS_news where click>=" & hit & " and created=1 and pagetype=0 order by click desc")
                    else
                        set rs = ("select top " & num & " classid,title,isimg,filename from NCMS_news where classid in(" & id & allchildclass(id) & ") and click>=" & hit & " and created=1 and pagetype=0 order by click desc")
                    end if
                else
("Tag [ncms:news] parameter [show] error!")
                    ()
                end if
                if  then
                    :set rs = nothing
TempHTM = "<li><font color=""red"">No news yet!</font></li>"
                    newsshow = TempHTM
                    exit function
                else
                    databox = ()
                    :set rs = nothing
                    for i = 0 to ubound(databox,2)
                        if databox(2,i) = 1 and show = "new" then
imgdot = "[<font color=""red"" size=""2"">Picture</font>]"
                        else
                            imgdot = ""
                        end if
                        TempHTM = TempHTM & "<td height=""" & lih & """ align=""left"" valign=""middle"">·<a href=""" & site_root & "/" & site_html & "/" & getclasspath(databox(0,i)) & "/" & databox(3,i) & site_extname & """ title=""" & databox(1,i) & """ target=""_" & tgt & """>" & gottopic(databox(1,i),len) & imgdot & "</a></td>" & chr(10)
                        if i = ubound(databox,2) then
                            TempHTM = TempHTM & "</tr>" & chr(10)
                        else
                            if cint((i+1) mod scolumn) = 0 then
                                TempHTM = TempHTM & "</tr>" & chr(10)
                                TempHTM = TempHTM & "<tr>" & chr(10)
                            end if
                        end if
                    next
                    databox = ""
                    TempHTM = TempHTM & "</table>" & chr(10)
                    newsshow = TempHTM
                end if
            case "image"
                if IsObjInstalled("") = true and jpeg_gate = 0 then
                    if show = "new" then
                        if id = 0 then
                            set rs = ("select top " & num & " classid,title,bimg,simg,filename from NCMS_news where isimg=1 and created=1 and pagetype=0 order by id desc")
                        else
                            set rs = ("select top " & num & " classid,title,bimg,simg,filename from NCMS_news where classid in(" & id & allchildclass(id) & ") and isimg=1 and created=1 and pagetype=0 order by id desc")
                        end if
                    elseif show = "elite" then
                        if id = 0 then
                            set rs = ("select top " & num & " classid,title,bimg,simg,filename from NCMS_news where elite=1 and isimg=1 and created=1 and pagetype=0 order by id desc")
                        else
                            set rs = ("select top " & num & " classid,title,bimg,simg,filename from NCMS_news where classid in(" & id & allchildclass(id) & ") and elite=1 and isimg=1 and created=1 and pagetype=0 order by id desc")
                        end if
                    elseif show = "hot" then
                        if id = 0 then
                            set rs = ("select top " & num & " classid,title,bimg,simg,filename from NCMS_news where click>=" & hit & " and isimg=1 and created=1 and pagetype=0 order by id desc")
                        else
                            set rs = ("select top " & num & " classid,title,bimg,simg,filename from NCMS_news where classid in(" & id & allchildclass(id) & ") and click>=" & hit & " and isimg=1 and created=1 and pagetype=0 order by id desc")
                        end if
                    else
("Tag [ncms:news] parameter [show] error!")
                        ()
                    end if
                    if  then
                        :set rs = nothing
TempHTM = "<li><font color=""red"">No news yet!</font></li>"
                        newsshow = TempHTM
                        exit function
                    else
                        databox = ()
                        :set rs = nothing
                        for i = 0 to ubound(databox,2)
                            TempHTM = TempHTM & "<td>" & chr(10)
                            TempHTM = TempHTM & "<div id=""simg""><a href=""" & site_root & "/" & site_html & "/" & getclasspath(databox(0,i)) & "/" & databox(4,i) & site_extname & """ target=""_" & tgt & """><img src=""" & site_root & "/" & site_upload & "/" & site_simg & "/" & databox(2,i) & """ alt=""" & databox(1,i) & """ /><br />" & gottopic(databox(1,i),len) & "</a></div>" & chr(10)
                            TempHTM = TempHTM & "</td>" & chr(10)
                            if i = ubound(databox,2) then
                                TempHTM = TempHTM & "</tr>" & chr(10)
                            else
                                if cint((i+1) mod scolumn) = 0 then
                                    TempHTM = TempHTM & "</tr>" & chr(10)
                                    TempHTM = TempHTM & "<tr>" & chr(10)
                                end if
                            end if
                            if checkfile("" & site_root & "/" & site_upload & "/" & site_bimg & "/" & databox(2,i) & "") = true then
                                set obox = ("")
                                     ("" & site_root & "/" & site_upload & "/" & site_bimg & "/" & databox(2,i) & "")
                                if imgw = "" or imgh = "" then
                                     = jpeg_width
                                     = jpeg_height
                                else
                                     = imgw
                                     = imgh
                                end if
                                     ("" & site_root & "/" & site_upload & "/" & site_simg & "/" & databox(3,i) & "")
                                set obox = nothing
                            end if
                        next
                        databox = ""
                        TempHTM = TempHTM & "</tr>" & chr(10)
                        TempHTM = TempHTM & "</table>" & chr(10)
                        newsshow = TempHTM
                    end if
                else
                    if show = "new" then
                        if id = 0 then
                            set rs = ("select top " & num & " classid,title,bimg,filename from NCMS_news where isimg=1 and created=1 and pagetype=0 order by id desc")
                        else
                            set rs = ("select top " & num & " classid,title,bimg,filename from NCMS_news where classid in(" & id & allchildclass(id) & ") and isimg=1 and created=1 and pagetype=0 order by id desc")
                        end if
                    elseif show = "elite" then
                        if id = 0 then
                            set rs = ("select top " & num & " classid,title,bimg,filename from NCMS_news where elite=1 and isimg=1 and created=1 and pagetype=0 order by id desc")
                        else
                            set rs = ("select top " & num & " classid,title,bimg,filename from NCMS_news where classid in(" & id & allchildclass(id) & ") and elite=1 and isimg=1 and created=1 and pagetype=0 order by id desc")
                        end if
                    elseif show = "hot" then
                        if id = 0 then
                            set rs = ("select top " & num & " classid,title,bimg,filename from NCMS_news where click>=" & hit & " and isimg=1 and created=1 and pagetype=0 order by id desc")
                        else
                            set rs = ("select top " & num & " classid,title,bimg,filename from NCMS_news where classid in(" & id & allchildclass(id) & ") and click>=" & hit & " and isimg=1 and created=1 and pagetype=0 order by id desc")
                        end if
                    else
("Tag [ncms:news] parameter [show] error!")
                        ()
                    end if
                    if  then
                        :set rs = nothing
TempHTM = "<li><font color=""red"">No news yet!</font></li>"
                        newsshow = TempHTM
                        exit function
                    else
                        databox = ()
                        :set rs = nothing
                        for i = 0 to ubound(databox,2)
                            TempHTM = TempHTM & "<td><div id=""simg""><a href=""" & site_root & "/" & site_html & "/" & getclasspath(databox(0,i)) & "/" & databox(3,i) & site_extname & """ target=""_" & tgt & """><img height=""" & jpeg_height & """ src=""" & site_root & "/" & site_upload & "/" & site_bimg & "/" & databox(2,i) & """ width=""" & jpeg_width & """ alt=""" & databox(1,i) & """ /></a></div></td>" & chr(10)
                            if i = ubound(databox,2) then
                                TempHTM = TempHTM & "</tr>" & chr(10)
                            else
                                if cint((i+1) mod scolumn) = 0 then
                                    TempHTM = TempHTM & "</tr>" & chr(10)
                                    TempHTM = TempHTM & "<tr>" & chr(10)
                                end if
                            end if
                        next
                        databox = ""
                        TempHTM = TempHTM & "</tr>" & chr(10)
                        TempHTM = TempHTM & "</table>" & chr(10)
                        newsshow = TempHTM
                    end if
                end if
            case else
("Tag [ncms:news] parameter [ty] error!")
                ()
        end select
    end function
end class

class ncmsinfotag
    public len,num
    public function infoshow()
        dim TempHTM,rs,databox,i
            TempHTM = "" & chr(10) & "<table cellpadding=""0"" cellspacing=""0"" width=""100%"" border=""0"">" & chr(10)
            TempHTM = TempHTM & "<tr>" & chr(10)
        set rs = ("select top " & num & " content,addtime from NCMS_info order by addtime desc")
        if  then
            :set rs = nothing
TempHTM = "<li><font color=""red"">No announcement information yet!</font></li>"
            infoshow = TempHTM
            exit function
        else
            databox = ()
            :set rs = nothing
            for i = 0 to ubound(databox,2)
                TempHTM = TempHTM & "<td>" & gottopic(databox(0,i),len) & "(" & databox(1,i) & ")</td>" & chr(10)
            next
            databox = ""
            TempHTM = TempHTM & "</tr>" & chr(10)
            TempHTM = TempHTM & "</table>" & chr(10)
            infoshow = TempHTM
        end if
    end function
end class

class ncmsheadtag
    public ty,len,num,imgw,imgh,size
    public function headshow(stype)
        dim rs,databox,TempHTM,i,NcmsP,NcmsL,NcmsT,tempstr:tempstr = "|"
        select case stype
            case "text"
                TempHTM = "" & chr(10) & "<table cellpadding=""0"" cellspacing=""0"" width=""100%"" border=""0"">" & chr(10)
                set rs = ("select top " & num & " id,classid,title,content,filename from NCMS_news where head=1 and isimg=0 and created=1 and pagetype=0 order by id desc")
                if  then
                    :set rs = nothing
TempHTM = "<li><font color=""red"">No headlines yet!</font></li>"
                    headshow = TempHTM
                    exit function
                else
                    databox = ()
                    :set rs = nothing
                    for i = 0 to ubound(databox,2)
                        TempHTM = TempHTM & "<tr><td><a href=""" & site_root & "/" & site_html & "/" & getclasspath(databox(1,i)) & "/" & databox(4,i) & site_extname & """ target=""_blank""><font size=""" & size & """><b>" & databox(2,i) & "</b></font></a></td></tr>" & chr(10)
TempHTM = TempHTM& "<tr><td>" & gettopic(LoseHtml(databox(3,i)),len) & "[<a href=""" & site_root & "/tools/?news&amp;newstitle=" & getnewstitle(databox(0,i)) & "#comment"" target=""_blank"" title=""Comment""><font color=""red"" size=""2"">Comments</font></a>]</td></tr>" & chr(10)
                    next
                    databox = ""
                    TempHTM = TempHTM & "</table>" & chr(10)
                    headshow = TempHTM
                end if
            case "image"
                set rs = ("select top " & num & " classid,title,bimg,filename from NCMS_news where head=1 and isimg=1 and created=1 and pagetype=0 order by id desc")
                if  then
                    :set rs = nothing
TempHTM = "<li><font color=""red"">No headlines yet!</font></li>"
                    headshow = TempHTM
                    exit function
                else
                    databox = ()
                    :set rs = nothing
                    for i = 0 to ubound(databox,2)
                        NcmsP = NcmsP & "" & site_root & "/" & site_upload & "/" & site_bimg & "/" & databox(2,i) & tempstr & ""
                        NcmsL = NcmsL & "" & site_root & "/" & site_html & "/" & getclasspath(databox(0,i)) & "/" & databox(3,i) & site_extname & tempstr & ""
                        NcmsT = NcmsT & "" & gottopic(databox(1,i),len) & tempstr & ""
                    next
                    databox = ""
                    TempHTM = TempHTM & "" & chr(10) & "<script language=""JavaScript"" type=""text/javascript"">" & chr(10)
                    TempHTM = TempHTM & "<!--" & chr(10)
                    TempHTM = TempHTM & "var NcmsPW = " & imgw & "" & chr(10)
                    TempHTM = TempHTM & "var NcmsPH = " & imgh & "" & chr(10)
                    TempHTM = TempHTM & "var NcmsTH = 0" & chr(10)
                    TempHTM = TempHTM & "var NcmsAH = NcmsPH + NcmsTH" & chr(10)
                    TempHTM = TempHTM & "var NcmsP = '" & left(NcmsP,strlength(NcmsP) - 1) & "'" & chr(10)
                    TempHTM = TempHTM & "var NcmsL = '" & left(NcmsL,strlength(NcmsL) - 1) & "'" & chr(10)
                    TempHTM = TempHTM & "var NcmsT = '" & left(NcmsT,strlength(NcmsT) - 1) & "'" & chr(10)
                    TempHTM = TempHTM & "('<object classid=""clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"" codebase=""/pub/shockwave/cabs/flash/#version=6,0,0,0"" width=""'+NcmsPW+'"" height=""'+NcmsAH+'"">');" & chr(10)
                    TempHTM = TempHTM & "('<param name=""allowScriptAccess"" value=""sameDomain"">');" & chr(10)
                    TempHTM = TempHTM & "('<param name=""movie"" value=""" & site_root & "/images/ncms/"">');" & chr(10)
                    TempHTM = TempHTM & "('<param name=""quality"" value=""high"">');" & chr(10)
                    TempHTM = TempHTM & "('<param name=""bgcolor"" value=""#252f3c"">');" & chr(10)
                    TempHTM = TempHTM & "('<param name=""menu"" value=""false"">');" & chr(10)
                    TempHTM = TempHTM & "('<param name=""wmode"" value=""opaque"">');" & chr(10)
                    TempHTM = TempHTM & "('<param name=""FlashVars"" value=""pics='+NcmsP+'&links='+NcmsL+'&texts='+NcmsT+'&borderwidth='+NcmsPW+'&borderheight='+NcmsPH+'&NcmsTHeight='+NcmsTH+'"">');" & chr(10)
                    TempHTM = TempHTM & "('<embed src=""" & site_root & "/images/ncms/"" wmode=""opaque"" FlashVars=""pics='+NcmsP+'&links='+NcmsL+'&texts='+NcmsT+'&borderwidth='+NcmsPW+'&borderheight='+NcmsPH+'&NcmsTHeight='+NcmsTH+'"" menu=""false"" bgcolor=""#252f3c"" quality=""high"" width=""'+NcmsPW+'"" height=""'+NcmsAH+'"" allowScriptAccess=""sameDomain"" type=""application/x-shockwave-flash"" pluginspage=""/go/getflashplayer"" />');" & chr(10)
                    TempHTM = TempHTM & "('</object>');" & chr(10)
                    TempHTM = TempHTM & "//-->" & chr(10)
                    TempHTM = TempHTM & "</script>" & chr(10)
                    headshow = TempHTM
                end if
            case else
("Tag [ncms:head] parameter [ty] error!")
                ()
        end select
    end function
end class

class ncmslinktag
    public num,ty
    public function linkshow(stype,scolumn)
        dim TempHTM,rs,databox,i
            TempHTM = "" & chr(10) & "<table cellpadding=""0"" cellspacing=""0"" width=""100%"" border=""0"">" & chr(10)
            TempHTM = TempHTM & "<tr>" & chr(10)
        select case stype
            case "text"
                set rs = ("select top " & num & " name,site from NCMS_link where kinds=0 order by orders asc")
                if  then
                    :set rs = nothing
TempHTM = "<li><font color=""red"">No text connection yet!</font></li>"
                    linkshow = TempHTM
                    exit function
                else
                    databox = ()
                    :set rs = nothing
                    for i = 0 to ubound(databox,2)
                        TempHTM = TempHTM & "<td><a href=""" & databox(1,i) & """ title=""" & databox(0,i) & """ target=""_blank"">" & databox(0,i) & "</a></td>" & chr(10)
                        if i = ubound(databox,2) then
                            TempHTM = TempHTM & "</tr>" & chr(10)
                        else
                            if cint((i+1) mod scolumn) = 0 then
                                TempHTM = TempHTM & "</tr>" & chr(10)
                                TempHTM = TempHTM & "<tr>" & chr(10)
                            end if
                        end if
                    next
                    databox = ""
                    TempHTM = TempHTM & "</table>" & chr(10)
                    linkshow = TempHTM
                end if
            case "image"
                set rs = ("select top " & num & " name,site,logo from NCMS_link where kinds=1 order by orders asc")
                if  then
                    :set rs = nothing
TempHTM = "<li><font color=""red"">No picture connection yet!</font></li>"
                    linkshow = TempHTM
                    exit function
                else
                    databox = ()
                    :set rs = nothing
                    for i = 0 to ubound(databox,2)
                        TempHTM = TempHTM & "<td><a href=""" & databox(1,i) & """ target=""_blank""><img src=""" & databox(2,i) & """ alt=""" & databox(0,i) & """ /></a></td>" & chr(10)
                        if i = ubound(databox,2) then
                            TempHTM = TempHTM & "</tr>" & chr(10)
                        else
                            if cint((i+1) mod scolumn) = 0 then
                                TempHTM = TempHTM & "</tr>" & chr(10)
                                TempHTM = TempHTM & "<tr>" & chr(10)
                            end if
                        end if
                    next
                    databox = ""
                    TempHTM = TempHTM & "</table>" & chr(10)
                    linkshow = TempHTM
                end if
            case else
("Tag [ncms:link] parameter [ty] error!")
                ()
        end select
    end function
end class

class ncmsmenutag
    public show
    public function menushow(stype)
        dim TempHTM,rs,databox,i,tempstr:tempstr = " | "
        select case stype
            case "center"
                TempHTM = "" & chr(10) & "<div id=""navbox"">" & chr(10)
                TempHTM = TempHTM & "<ul id=""nav"">" & chr(10)
                set rs = ("select id,cname,ename,isout,isurl,link from NCMS_class where parent=0 and kinds=1 order by orders asc")
                if  then
                    :set rs = nothing
                    TempHTM = ""
                    menushow = TempHTM
                    exit function
                else
                    databox = ()
                    :set rs = nothing
                end if
                for i = 0 to ubound(databox,2)
                    if databox(4,i) = 0 then
                        TempHTM = TempHTM & "<li><a href=""" & site_root & "/" & site_html & "/" & databox(2,i) & "/index" & site_extname & """ title=""" & databox(1,i) & """>" & databox(1,i) & "</a>" & childmenushow(databox(0,i)) & "</li>" & chr(10)
                    elseif databox(3,i) = 1 then
                        if databox(4,i) = 0 then
                            TempHTM = TempHTM & "<li><a href=""" & site_root & "/" & site_html & "/" & databox(2,i) & "/" & databox(5,i) & """ title=""" & databox(1,i) & """>" & databox(1,i) & "</a>" & childmenushow(databox(0,i)) & "</li>" & chr(10)
                        elseif databox(4,i) = 1 then
                            TempHTM = TempHTM & "<li><a href=""" & databox(5,i) & """ title=""" & databox(1,i) & """>" & databox(1,i) & "</a></li>" & chr(10)
                        end if
                    end if
                next:databox = ""
                TempHTM = TempHTM & "</ul>" & chr(10)
                TempHTM = TempHTM & "</div>" & chr(10)
                menushow = TempHTM
            case "top"
                set rs = ("select id,cname,ename,isout,isurl,link from NCMS_class where parent=0 and kinds=2 order by orders asc")
                if  then
                    :set rs = nothing
                    TempHTM = ""
                    menushow = TempHTM
                    exit function
                else
                    databox = ()
                    :set rs = nothing
                    for i = 0 to ubound(databox,2)
                        if i = ubound(databox,2) then tempstr = ""
                        if databox(3,i) = 0 then
                            TempHTM = TempHTM & "<a href=""" & site_root & "/" & site_html & "/" & databox(2,i) & "/index" & site_extname & """>" & databox(1,i) & "</a>" & tempstr & ""
                        elseif databox(3,i) = 1 then
                            if databox(4,i) = 0 then
                                TempHTM = TempHTM & "<a href=""" & site_root & "/" & site_html & "/" & databox(2,i) & "/" & databox(5,i) & """>" & databox(1,i) & "</a>" & tempstr & ""
                            elseif databox(4,i) = 1 then
                                TempHTM = TempHTM & "<a href=""" & databox(5,i) & """>" & databox(1,i) & "</a>" & tempstr & ""
                            end if
                        end if
                    next
                    menushow = TempHTM
                end if
            case "bottom"
                set rs = ("select id,cname,ename,isout,isurl,link from NCMS_class where parent=0 and kinds=3 order by orders asc")
                if  then
                    :set rs = nothing
                    TempHTM = ""
                    menushow = TempHTM
                    exit function
                else
                    databox = ()
                    :set rs = nothing
                    for i = 0 to ubound(databox,2)
                        if i = ubound(databox,2) then tempstr = ""
                        if databox(3,i) = 0 then
                            TempHTM = TempHTM & "<a href=""" & site_root & "/" & site_html & "/" & databox(2,i) & "/"">" & databox(1,i) & "</a>" & tempstr & ""
                        elseif databox(3,i) = 1 then
                            if databox(4,i) = 0 then
                                TempHTM = TempHTM & "<a href=""" & site_root & "/" & site_html & "/" & databox(2,i) & "/" & databox(5,i) & """>" & databox(1,i) & "</a>" & tempstr & ""
                            elseif databox(4,i) = 1 then
                                TempHTM = TempHTM & "<a href=""" & databox(5,i) & """>" & databox(1,i) & "</a>" & tempstr & ""
                            end if
                        end if
                    next
                    menushow = TempHTM
                end if
            case else
("Tag [ncms:menu] parameter [show] error!")
                ()
        end select
    end function
    private function childmenushow(id)
        dim TempHTM,rschild,box,j
            TempHTM = "" & chr(10) & "<ul>" & chr(10)
        set rschild = ("select id,cname,ename,isout,isurl,link from NCMS_class where parent=" & id & " and kinds=1 order by orders asc")
        if  then
            :set rschild = nothing
            TempHTM = ""
            childmenushow = TempHTM
            exit function
        else
            box = ()
            :set rschild = nothing
        end if
        for j = 0 to ubound(box,2)
            if box(3,j) = 0 then
                TempHTM = TempHTM & "<li><a href=""" & site_root & "/" & site_html & "/" & box(2,j) & "/"" title=""" & box(1,j) & """>" & box(1,j) & "</a></li>" & chr(10)
            elseif box(3,j) = 1 then
                if box(4,j) = 0 then
                    TempHTM = TempHTM & "<li><a href=""" & site_root & "/" & site_html & "/" & box(2,j) & "/" & box(5,j) & """ title=""" & box(1,j) & """>" & box(1,j) & "</a></li>" & chr(10)
                elseif box(4,j) = 1 then
                    TempHTM = TempHTM & "<li><a href=""" & box(5,j) & """ title=""" & box(1,j) & """>" & box(1,j) & "</a></li>" & chr(10)
                end if
            end if
        next:box = ""
        TempHTM = TempHTM & "</ul>" & chr(10)
        childmenushow = TempHTM
    end function
end class

class ncmsrelatetag
    public len,num,lih
    public function relateshow(scolumn,classid,newsid,keywords)
        if keywords = "" or isnull(keywords) then
Relateshow = "<li><font color=""red"">No related news yet!</font></li>"
            exit function
        end if
        dim arr,i,TempSql
            arr = split(keywords,",",3,1)
        for i = 0 to ubound(arr)
            if TempSql <> "" then
                TempSql = TempSql & "or title like '%" & arr(i) & "%' or keywords like '%" & arr(i) & "%'"
            else
                TempSql = TempSql & "title like '%" & arr(i) & "%' or keywords like '%" & arr(i) & "%'"
            end if
        next
        if TempSql <> "" then
            TempSql = "where (" & TempSql & ") and class and id <> " & newsid & " order by id desc"
        end if
        dim TempHTM:TempHTM = "" & chr(10) & "<table cellpadding=""0"" cellspacing=""0"" width=""100%"" border=""0"">" & chr(10)
            TempHTM = TempHTM & "<tr>" & chr(10)
        dim rs,databox,j
        set rs = ("select top " & num & " classid,title,filename from NCMS_news " & TempSql)
        if  then
            :set rs = nothing
TempHTM = "<li><font color=""red"">No related news yet!</font></li>"
            relateshow = TempHTM
        else
            databox = ()
            :set rs = nothing
            for j = 0 to ubound(databox,2)
                TempHTM = TempHTM & "<td height=""" & lih & """ align=""left"" valign=""middle"">·<a href=""" & site_root & "/" & site_html & "/" & getclasspath(databox(0,j)) & "/" & databox(2,j) & site_extname & """ title=""" & databox(1,j) & """ target=""_blank"">" & gottopic(databox(1,j),len) & "</a></td>" & chr(10)
                if j = ubound(databox,2) then
                    TempHTM = TempHTM & "</tr>" & chr(10)
                else
                    if cint((j+1) mod scolumn) = 0 then
                        TempHTM = TempHTM & "</tr>" & chr(10)
                        TempHTM = TempHTM & "<tr>" & chr(10)
                    end if
                end if
            next
            TempHTM = TempHTM & "</table>" & chr(10)
            relateshow = TempHTM
        end if
    end function
end class

class ncmspagetag
    public show
    public function pageshow(stype,classid,newsid)
        dim TempHTM,rs,databox
            TempHTM = "" & chr(10) & "<div id=""page"">"
        select case stype
            case "last"
                set rs = ("select top 1 id,classid,title,filename from NCMS_news where class and id > " & newsid & "")
                if  or  then
                    :set rs = nothing
TempHTM = TempHTM & "Previous article: <font color=""red"">No previous article</font>"
                    TempHTM = TempHTM & "</div>" & chr(10)
                    pageshow = TempHTM
                    exit function
                else
                    databox = ()
                    :set rs = nothing
TempHTM = TempHTM& "Previous article: <a href=""" & site_root & "/" & site_html & "/" & getclasspath(databox(1,0)) & "/" & databox(3,0) & site_extname & "">" & databox(2,0) & "</a>"
                    TempHTM = TempHTM & "</div>" & chr(10)
                    databox = ""
                    pageshow = TempHTM
                end if
            case "next"
                set rs = ("select top 1 id,classid,title,filename from NCMS_news where class and id < " & newsid & " order by id desc")
                if  or  then
                    :set rs = nothing
TempHTM = TempHTM & "Next article: <font color=""red"">No next article</font>"
                    TempHTM = TempHTM & "</div>" & chr(10)
                    pageshow = TempHTM
                    exit function
                else
                    databox = ()
                    :set rs = nothing
TempHTM = TempHTM& "Next article: <a href=""" & site_root & "/" & site_html & "/" & getclasspath(databox(1,0)) & "/" & databox(3,0) & site_extname & "">" & databox(2,0) & "</a>"
                    TempHTM = TempHTM & "</div>" & chr(10)
                    databox = ""
                    pageshow = TempHTM
                end if
            case else
("Tag [news:page] parameter [show] error!")
                ()
        end select
    end function
end class

class X_ncmsnewstag
    public id,ty,show,len,num,lih,hit
    public function newsshow(stype,scolumn,strHtml)
        dim TempHTM,xsql,rs,databox,i
            TempHTM = "" & chr(10) & "<table cellpadding=""0"" cellspacing=""0"" width=""100%"" border=""0"">" & chr(10)
            TempHTM = TempHTM & "<tr>" & chr(10)
        select case stype
            case "text"
                if show = "new" then
                    if id = 0 then
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where created=1 and pagetype=0 order by id desc")
                    else
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where classid in(" & id & allchildclass(id) & ") and created=1 and pagetype=0 order by id desc")
                    end if
                elseif show = "elite" then
                    if id = 0 then
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where elite=1 and created=1 and pagetype=0 order by id desc")
                    else
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where classid in(" & id & allchildclass(id) & ") and elite=1 and created=1 and pagetype=0 order by id desc")
                    end if
                elseif show = "hot" then
                    if id = 0 then
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where click>=" & hit & " and created=1 and pagetype=0 order by click desc")
                    else
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where classid in(" & id & allchildclass(id) & ") and click>=" & hit & " and created=1 and pagetype=0 order by click desc")
                    end if
                else
("Tag [ncms:free] parameter [show] error!")
                    ()
                end if
            case "image"
                if show = "new" then
                    if id = 0 then
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where isimg=1 and created=1 and pagetype=0 order by id desc")
                    else
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where classid in(" & id & allchildclass(id) & ") and isimg=1 and created=1 and pagetype=0 order by id desc")
                    end if
                elseif show = "elite" then
                    if id = 0 then
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where isimg=1 and elite=1 and created=1 and pagetype=0 order by id desc")
                    else
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where classid in(" & id & allchildclass(id) & ") and isimg=1 and elite=1 and created=1 and pagetype=0 order by id desc")
                    end if
                elseif show = "hot" then
                    if id = 0 then
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where isimg=1 and click>=" & hit & " and created=1 and pagetype=0 order by click desc")
                    else
                        set rs = ("select top " & num & " id,classid,title,content,click,isimg,bimg,simg,filename,addtime from NCMS_news where classid in(" & id & allchildclass(id) & ") and isimg=1 and click>=" & hit & " and created=1 and pagetype=0 order by click desc")
                    end if
                else
("Tag [ncms:free] parameter [show] error!")
                    ()
                end if
            case else
("Tag [ncms:free] parameter [ty] error!")
                ()
        end select
        if  then
            :set rs = nothing
TempHTM = "<li><font color=""red"">No news yet!</font></li>"
            newsshow = TempHTM
            exit function
        else
            databox = ()
            :set rs = nothing
            for i = 0 to ubound(databox,2)
                TempHTM = TempHTM & "<td height=""" & lih & """ align=""left"" valign=""middle"">" & strHtml & "</td>" & chr(10)
                if i = ubound(databox,2) then
                    TempHTM = TempHTM & "</tr>" & chr(10)
                else
                    if cint((i+1) mod scolumn) = 0 then
                        TempHTM = TempHTM & "</tr>" & chr(10)
                        TempHTM = TempHTM & "<tr>" & chr(10)
                    end if
                end if
                dim charclass,PatrnStr
                set charclass = new stringclass
                PatrnStr = "\{\$classname\$\}"
                TempHTM = (PatrnStr,TempHTM,"<a href=""" & site_root & "/" & site_html & "/" & getclasspath(databox(1,i)) & "/index" & site_extname & """ target=""_blank"">" & getclassname(databox(1,i)) & "</a>")
                PatrnStr = "\{\$title\$\}"
                TempHTM = (PatrnStr,TempHTM,gottopic(LoseHtml(databox(2,i)),len))
                PatrnStr = "\{\$content\$\}"
                TempHTM = (PatrnStr,TempHTM,gottopic(LoseHtml(databox(3,i)),len))
                PatrnStr = "\{\$click\$\}"
                TempHTM = (PatrnStr,TempHTM,databox(4,i))
                PatrnStr = "\{\$filepath\$\}"
                TempHTM = (PatrnStr,TempHTM,"" & site_root & "/" & site_html & "/" & getclasspath(databox(1,i)) & "/" & databox(8,i) & site_extname & "")
                PatrnStr = "\{\$addtime\$\}"
                TempHTM = (PatrnStr,TempHTM,formattagdate(databox(9,i),datestyle))
                PatrnStr = "\{\$imgpath\$\}"
                if IsObjInstalled("") = true and jpeg_gate = 0 then
                    TempHTM = (PatrnStr,TempHTM,"" & site_root & "/" & site_upload & "/" & site_simg & "/" & databox(7,i) & "")
                else
                    TempHTM = (PatrnStr,TempHTM,"" & site_root & "/" & site_upload & "/" & site_bimg & "/" & databox(6,i) & "")
                end if
                PatrnStr = "\{\$comment\$\}"
TempHTM = (PatrnStr,TempHTM,"[<a href=""" & site_root & "/tools/?news&amp;newstitle=" & getnewstitle(databox(0,i)) & "#comment"" target=""_blank"" title=""Comment""><font color=""red"" size=""2"">Comment</font></a>]")
            next
            databox = ""
            TempHTM = TempHTM & "</table>" & chr(10)
            newsshow = TempHTM
        end if
    end function
end class

function guide(id)
    dim TempHTM
    if id = "" or len(id) = 0 or not isnumeric(id) then
TempHTM = "Current location: <a href=""" & site_root & "/index" & site_extname & "">Home</a> >>"
    else
        dim rs
        set rs = ("select top 1 id,parent,cname,ename from NCMS_class where parent"))
            TempHTM = TempHTM & "<a href=""" & site_root & "/" & site_html & "/" & rs("ename") & "/index" & site_extname & """>" & rs("cname") & "</a> >> "
        end if
        :set rs = nothing
        if id = 0 then
TempHTM = TempHTM& "Current location: <a href=""" & site_root & "/index" & site_extname & """>Home</a> >> "
        end if
    end if
    guide = TempHTM
end function

function createindex()
    dim Temp:Temp = ""
        Temp = processcustomtag(loadtempletfile("../templet/" & site_dtemp & ""))
        Temp = X_processcustomtag(Temp)
    dim charclass
    set charclass = new stringclass
    dim PatrnStr
        PatrnStr = "<title>.*?</title>"
        Temp = (PatrnStr,Temp,"<title>" & site_name & "</title>")
        PatrnStr = "\{\$guide\$\}"
        Temp = (PatrnStr,Temp,guide(""))
        PatrnStr = "\{\$keywords\$\}"
        Temp = (PatrnStr,Temp,site_keywords)
        PatrnStr = "\{\$search\$\}"
        Temp = (PatrnStr,Temp,search())
        PatrnStr = "\{\$description\$\}"
        Temp = (PatrnStr,Temp,site_description)
        PatrnStr = "\{\$copyright\$\}"
        Temp = (PatrnStr,Temp,site_copyright)
        PatrnStr = "\{\$root\$\}"
        Temp = (PatrnStr,Temp,site_root)
    dim sPATH:sPATH = "" & site_root & "/index" & site_extname & ""
    dim objstream
    set objstream = ("")
    with objstream
        .open
        .charset = "" & chrset & ""
        .position = 
        .writetext = Temp
        .savetofile (sPATH),2
        .close
    end with
    set objstream = nothing
    if  <> 0 then
        
        createindex = false
    else
        createindex = true
    end if
end function
Previous page1234Next pageRead the full text