asp常用函數(shù)集合,非常不錯以后研究第2/4頁
更新時間:2008年01月12日 16:36:13 作者:
asp常用函數(shù)集合,非常不錯以后研究
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 = conn.execute("select top " & num & " classid,title,isimg,filename from NCMS_news where created=1 and pagetype=0 order by id desc")
else
set rs = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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
response.write("標簽[ncms:news]參數(shù)[show]錯誤!")
response.end()
end if
if rs.eof then
rs.close:set rs = nothing
TempHTM = "<li><font color=""red"">暫時沒有新聞!</font></li>"
newsshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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"">圖</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("persits.jpeg") = true and jpeg_gate = 0 then
if show = "new" then
if id = 0 then
set rs = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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
response.write("標簽[ncms:news]參數(shù)[show]錯誤!")
response.end()
end if
if rs.eof then
rs.close:set rs = nothing
TempHTM = "<li><font color=""red"">暫時沒有新聞!</font></li>"
newsshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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 = server.createobject("persits.jpeg")
obox.open server.mappath("" & site_root & "/" & site_upload & "/" & site_bimg & "/" & databox(2,i) & "")
if imgw = "" or imgh = "" then
obox.width = jpeg_width
obox.height = jpeg_height
else
obox.width = imgw
obox.height = imgh
end if
obox.save server.mappath("" & 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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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
response.write("標簽[ncms:news]參數(shù)[show]錯誤!")
response.end()
end if
if rs.eof then
rs.close:set rs = nothing
TempHTM = "<li><font color=""red"">暫時沒有新聞!</font></li>"
newsshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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
response.write("標簽[ncms:news]參數(shù)[ty]錯誤!")
response.end()
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 = conn.execute("select top " & num & " content,addtime from NCMS_info order by addtime desc")
if rs.eof then
rs.close:set rs = nothing
TempHTM = "<li><font color=""red"">暫時沒有公告信息!</font></li>"
infoshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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 = conn.execute("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 rs.eof then
rs.close:set rs = nothing
TempHTM = "<li><font color=""red"">暫時沒有頭條新聞!</font></li>"
headshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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>" & gottopic(LoseHtml(databox(3,i)),len) & "[<a href=""" & site_root & "/tools/comment.asp?newsid=" & databox(0,i) & "&newstitle=" & getnewstitle(databox(0,i)) & "#comment"" target=""_blank"" title=""評論""><font color=""red"" size=""2"">評論</font></a>]</td></tr>" & chr(10)
next
databox = ""
TempHTM = TempHTM & "</table>" & chr(10)
headshow = TempHTM
end if
case "image"
set rs = conn.execute("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 rs.eof then
rs.close:set rs = nothing
TempHTM = "<li><font color=""red"">暫時沒有頭條新聞!</font></li>"
headshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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 & "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=""'+NcmsPW+'"" height=""'+NcmsAH+'"">');" & chr(10)
TempHTM = TempHTM & "document.write('<param name=""allowScriptAccess"" value=""sameDomain"">');" & chr(10)
TempHTM = TempHTM & "document.write('<param name=""movie"" value=""" & site_root & "/images/ncms/head.swf"">');" & chr(10)
TempHTM = TempHTM & "document.write('<param name=""quality"" value=""high"">');" & chr(10)
TempHTM = TempHTM & "document.write('<param name=""bgcolor"" value=""#252f3c"">');" & chr(10)
TempHTM = TempHTM & "document.write('<param name=""menu"" value=""false"">');" & chr(10)
TempHTM = TempHTM & "document.write('<param name=""wmode"" value=""opaque"">');" & chr(10)
TempHTM = TempHTM & "document.write('<param name=""FlashVars"" value=""pics='+NcmsP+'&links='+NcmsL+'&texts='+NcmsT+'&borderwidth='+NcmsPW+'&borderheight='+NcmsPH+'&NcmsTHeight='+NcmsTH+'"">');" & chr(10)
TempHTM = TempHTM & "document.write('<embed src=""" & site_root & "/images/ncms/head.swf"" 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=""http://www.macromedia.com/go/getflashplayer"" />');" & chr(10)
TempHTM = TempHTM & "document.write('</object>');" & chr(10)
TempHTM = TempHTM & "http://-->" & chr(10)
TempHTM = TempHTM & "</script>" & chr(10)
headshow = TempHTM
end if
case else
response.write("標簽[ncms:head]參數(shù)[ty]錯誤!")
response.end()
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 = conn.execute("select top " & num & " name,site from NCMS_link where kinds=0 order by orders asc")
if rs.eof then
rs.close:set rs = nothing
TempHTM = "<li><font color=""red"">暫時沒有文字連接!</font></li>"
linkshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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 = conn.execute("select top " & num & " name,site,logo from NCMS_link where kinds=1 order by orders asc")
if rs.eof then
rs.close:set rs = nothing
TempHTM = "<li><font color=""red"">暫時沒有圖片連接!</font></li>"
linkshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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
response.write("標簽[ncms:link]參數(shù)[ty]錯誤!")
response.end()
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 = conn.execute("select id,cname,ename,isout,isurl,link from NCMS_class where parent=0 and kinds=1 order by orders asc")
if rs.eof then
rs.close:set rs = nothing
TempHTM = ""
menushow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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 = conn.execute("select id,cname,ename,isout,isurl,link from NCMS_class where parent=0 and kinds=2 order by orders asc")
if rs.eof then
rs.close:set rs = nothing
TempHTM = ""
menushow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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 = conn.execute("select id,cname,ename,isout,isurl,link from NCMS_class where parent=0 and kinds=3 order by orders asc")
if rs.eof then
rs.close:set rs = nothing
TempHTM = ""
menushow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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
response.write("標簽[ncms:menu]參數(shù)[show]錯誤!")
response.end()
end select
end function
private function childmenushow(id)
dim TempHTM,rschild,box,j
TempHTM = "" & chr(10) & "<ul>" & chr(10)
set rschild = conn.execute("select id,cname,ename,isout,isurl,link from NCMS_class where parent=" & id & " and kinds=1 order by orders asc")
if rschild.eof then
rschild.close:set rschild = nothing
TempHTM = ""
childmenushow = TempHTM
exit function
else
box = rschild.getrows()
rschild.close: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"">暫時沒有相關新聞!</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 classid=" & classid & " 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 = conn.execute("select top " & num & " classid,title,filename from NCMS_news " & TempSql)
if rs.eof then
rs.close:set rs = nothing
TempHTM = "<li><font color=""red"">暫時沒有相關新聞!</font></li>"
relateshow = TempHTM
else
databox = rs.getrows()
rs.close: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 = conn.execute("select top 1 id,classid,title,filename from NCMS_news where classid=" & classid & " and id > " & newsid & "")
if rs.eof or rs.bof then
rs.close:set rs = nothing
TempHTM = TempHTM & "上一篇:<font color=""red"">沒有上一篇</font>"
TempHTM = TempHTM & "</div>" & chr(10)
pageshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close:set rs = nothing
TempHTM = TempHTM & "上一篇:<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 = conn.execute("select top 1 id,classid,title,filename from NCMS_news where classid=" & classid & " and id < " & newsid & " order by id desc")
if rs.eof or rs.bof then
rs.close:set rs = nothing
TempHTM = TempHTM & "下一篇:<font color=""red"">沒有下一篇</font>"
TempHTM = TempHTM & "</div>" & chr(10)
pageshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close:set rs = nothing
TempHTM = TempHTM & "下一篇:<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
response.write("標簽[news:page]參數(shù)[show]錯誤!")
response.end()
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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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
response.write("標簽[ncms:free]參數(shù)[show]錯誤!")
response.end()
end if
case "image"
if show = "new" then
if id = 0 then
set rs = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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 = conn.execute("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
response.write("標簽[ncms:free]參數(shù)[show]錯誤!")
response.end()
end if
case else
response.write("標簽[ncms:free]參數(shù)[ty]錯誤!")
response.end()
end select
if rs.eof then
rs.close:set rs = nothing
TempHTM = "<li><font color=""red"">暫時沒有新聞!</font></li>"
newsshow = TempHTM
exit function
else
databox = rs.getrows()
rs.close: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 = charclass.replacestr(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 = charclass.replacestr(PatrnStr,TempHTM,gottopic(LoseHtml(databox(2,i)),len))
PatrnStr = "\{\$content\$\}"
TempHTM = charclass.replacestr(PatrnStr,TempHTM,gottopic(LoseHtml(databox(3,i)),len))
PatrnStr = "\{\$click\$\}"
TempHTM = charclass.replacestr(PatrnStr,TempHTM,databox(4,i))
PatrnStr = "\{\$filepath\$\}"
TempHTM = charclass.replacestr(PatrnStr,TempHTM,"" & site_root & "/" & site_html & "/" & getclasspath(databox(1,i)) & "/" & databox(8,i) & site_extname & "")
PatrnStr = "\{\$addtime\$\}"
TempHTM = charclass.replacestr(PatrnStr,TempHTM,formattagdate(databox(9,i),datestyle))
PatrnStr = "\{\$imgpath\$\}"
if IsObjInstalled("persits.jpeg") = true and jpeg_gate = 0 then
TempHTM = charclass.replacestr(PatrnStr,TempHTM,"" & site_root & "/" & site_upload & "/" & site_simg & "/" & databox(7,i) & "")
else
TempHTM = charclass.replacestr(PatrnStr,TempHTM,"" & site_root & "/" & site_upload & "/" & site_bimg & "/" & databox(6,i) & "")
end if
PatrnStr = "\{\$comment\$\}"
TempHTM = charclass.replacestr(PatrnStr,TempHTM,"[<a href=""" & site_root & "/tools/comment.asp?newsid=" & databox(0,i) & "&newstitle=" & getnewstitle(databox(0,i)) & "#comment"" target=""_blank"" title=""評論""><font color=""red"" size=""2"">評論</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 = "當前位置 : <a href=""" & site_root & "/index" & site_extname & """>首頁</a> >>"
else
dim rs
set rs = conn.execute("select top 1 id,parent,cname,ename from NCMS_class where id=" & id)
if not rs.eof then
TempHTM = TempHTM & guide(rs("parent"))
TempHTM = TempHTM & "<a href=""" & site_root & "/" & site_html & "/" & rs("ename") & "/index" & site_extname & """>" & rs("cname") & "</a> >> "
end if
rs.close:set rs = nothing
if id = 0 then
TempHTM = TempHTM & "當前位置 : <a href=""" & site_root & "/index" & site_extname & """>首頁</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 = charclass.replacestr(PatrnStr,Temp,"<title>" & site_name & "</title>")
PatrnStr = "\{\$guide\$\}"
Temp = charclass.replacestr(PatrnStr,Temp,guide(""))
PatrnStr = "\{\$keywords\$\}"
Temp = charclass.replacestr(PatrnStr,Temp,site_keywords)
PatrnStr = "\{\$search\$\}"
Temp = charclass.replacestr(PatrnStr,Temp,search())
PatrnStr = "\{\$description\$\}"
Temp = charclass.replacestr(PatrnStr,Temp,site_description)
PatrnStr = "\{\$copyright\$\}"
Temp = charclass.replacestr(PatrnStr,Temp,site_copyright)
PatrnStr = "\{\$root\$\}"
Temp = charclass.replacestr(PatrnStr,Temp,site_root)
dim sPATH:sPATH = "" & site_root & "/index" & site_extname & ""
dim objstream
set objstream = server.createobject("adodb.stream")
with objstream
.open
.charset = "" & chrset & ""
.position = objstream.size
.writetext = Temp
.savetofile server.mappath(sPATH),2
.close
end with
set objstream = nothing
if err.number <> 0 then
err.clear
createindex = false
else
createindex = true
end if
end function
相關文章
Microsoft VBScript 編譯器錯誤 錯誤原因 代碼大全
這篇文章主要介紹了Microsoft VBScript 編譯器錯誤 錯誤原因 代碼大全,需要的朋友可以參考下2015-07-07asp下利用fso實現(xiàn)文件夾或文件移動改名等操作函數(shù)
以后利用fso來操作文件和文件夾就方便了2008-01-01asp提示Server 對象 錯誤 ASP 0178 : 80070005
今天幫客戶配置好服務器以后測試程序發(fā)現(xiàn)asp程序提示Server 對象 錯誤 ASP 0178 : 80070005,經(jīng)測試是因為權限問題。2011-11-11