<% dim ClassID,IncludeChild,SpecialID,ArticleNum,TitleMaxLen,ContentMaxLen,ShowType,ShowCols dim ShowProperty,ShowClassName,ShowIncludePic,ShowTitle,ShowUpdateTime,ShowHits,ShowAuthor,ShowHot,ShowMore dim Hot,Elite,DateNum,OrderField,OrderType,ImgWidth,ImgHeight dim SystemPath,rs,sql,str,str1,topicLen,topic dim i,FileType dim tClass,trs,arrClassID dim tLayout,LayoutFileName_Class,LayoutFileName_Article dim Author,AuthorName,AuthorEmail ClassID=trim(request.querystring("ClassID")) IncludeChild=trim(request.QueryString("IncludeChild")) SpecialID=trim(request.querystring("SpecialID")) ArticleNum=trim(request.querystring("ArticleNum")) TitleMaxLen=trim(request.querystring("TitleMaxLen")) ContentMaxLen=trim(request.querystring("ContentMaxLen")) ShowType=trim(request.querystring("ShowType")) ShowCols=trim(request.querystring("ShowCols")) ShowProperty=trim(request.querystring("ShowProperty")) ShowClassName=trim(request.querystring("ShowClassName")) ShowIncludePic=trim(request.querystring("ShowIncludePic")) ShowTitle=trim(request.querystring("ShowTitle")) ShowUpdateTime=trim(request.querystring("ShowUpdateTime")) ShowHits=trim(request.querystring("ShowHits")) ShowAuthor=trim(request.querystring("ShowAuthor")) ShowHot=trim(request.querystring("ShowHot")) ShowMore=trim(request.querystring("ShowMore")) Hot=trim(request.querystring("Hot")) Elite=trim(request.querystring("Elite")) DateNum=trim(request.querystring("DateNum")) OrderField=trim(request.querystring("OrderField")) OrderType=trim(request.querystring("OrderType")) ImgWidth=trim(request.querystring("ImgWidth")) ImgHeight=trim(request.querystring("ImgHeight")) SystemPath="http://"&request.servervariables("server_name")&replace(request.servervariables("script_name"),"article_js.asp","") if ShowType<>"" then ShowType=Cint(ShowType) else ShowType=1 end if if ShowCols<>"" then ShowCols=Cint(ShowCols) else ShowCols=1 end if if ContentMaxLen<>"" then ContentMaxLen=Cint(ContentMaxLen) else ContentMaxLen=200 end if if ClassID="" then ClassID=0 else ClassID=Clng(ClassID) end if if SpecialID="" then SpecialID=0 else SpecialID=Clng(SpecialID) end if set tLayout=conn.execute("select LayoutFileName from Layout where LayoutType=2 and IsDefault=True") LayoutFileName_Class=tLayout(0) if isNull(LayoutFileName_Class) then LayoutFileName_Class="ShowClass.asp" set tLayout=conn.execute("select LayoutFileName from Layout where LayoutType=3 and IsDefault=True") LayoutFileName_Article=tLayout(0) if isNull(LayoutFileName_Article) then LayoutFileName_Article="ShowArticle.asp" set tLayout=nothing sql="select" if ArticleNum<>"" then sql=sql & " top " & Cint(ArticleNum) if ShowClassName="true" then sql=sql & " A.ArticleID,A.ClassID,C.ClassName,A.Title,A.Key,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.TitleFontColor,A.TitleFontType,A.Content," sql=sql & " A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Article A" sql=sql & " inner join ArticleClass C on A.ClassID=C.ClassID where A.Deleted=False and A.Passed=True" else sql=sql & " A.ArticleID,A.ClassID,L.LayoutID,L.LayoutFileName,A.Title,A.Key,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.TitleFontColor,A.TitleFontType,A.Content," sql=sql & " A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Article A" sql=sql & " inner join Layout L on A.LayoutID=L.LayoutID where A.Deleted=False and A.Passed=True" end if if ClassID>0 then set tClass=conn.execute("select ClassID,ParentPath,Child From ArticleClass where ClassID=" & ClassID) if tClass.bof and tClass.eof then response.write "document.write (" & Chr(34) & "找不到指定的栏目,可能已经被管理员删除!请重新生成JS调用代码。" & Chr(34) & ");" response.end else if IncludeChild="true" then if tClass(2)>0 then arrClassID=tClass(0) set trs=conn.execute("select ClassID from ArticleClass where ParentID=" & tClass(0) & " or ParentPath like '%" & tClass(1) & "," & tClass(0) & ",%' and Child=0 and LinkUrl=''") do while not trs.eof arrClassID=arrClassID & "," & trs(0) trs.movenext loop set trs=nothing sql=sql & " and A.ClassID in (" & arrClassID & ")" else sql=sql & " and A.ClassID=" & Clng(ClassID) end if else sql=sql & " and A.ClassID=" & Clng(ClassID) end if end if set tClass=nothing end if if SpecialID>0 then sql=sql & " and A.SpecialID=" & SpecialID if ShowType=3 or ShowType=4 then sql=sql & " and A.DefaultPicUrl<>''" if Hot="true" then sql=sql & " and A.Hits>=" & HitsOfHot if Elite="true" then sql=sql & " and A.Elite=True" if DateNum<>"" then sql=sql & " and DATEDIFF('d',UpdateTime,Date())<=" & Cint(DateNum) sql=sql & " order by A.OnTop asc" if OrderField<>"" then sql=sql & " , A." & OrderField if OrderType<>"" then sql=sql & " " & OrderType else sql=sql & " asc" end if set rs=server.createObject("Adodb.recordset") rs.open sql,conn,1,1 if rs.bof and rs.eof then response.write "document.write (" & Chr(34) & "没有符合条件的文章" & Chr(34) & ");" else if ShowType=3 or ShowType=4 then response.write "document.write (" & Chr(34) & "" & Chr(34) & ");" & vbcrlf end if do while not rs.eof if TitleMaxLen<>"" then topic=gotTopic(rs("title"),Cint(TitleMaxLen)) else topic=rs("title") end if if rs("TitleFontType")=1 then topic="" & topic & "" elseif rs("TitleFontType")=2 then topic="" & topic & "" elseif rs("TitleFontType")=3 then topic="" & topic & "" end if if rs("TitleFontColor")<>"" then topic="" & topic & "" end if Author=rs("Author") if instr(Author,"|")>0 then AuthorName=left(Author,instr(Author,"|")-1) AuthorEmail=right(Author,len(Author)-instr(Author,"|")-1) else AuthorName=Author AuthorEmail="" end if if ShowType=1 or ShowType=2 then str="" else str="" elseif ShowType=4 then str=str & "" end if rs.movenext if ShowType=3 or ShowType=4 then i=i+1 if ((i mod ShowCols=0) and (not rs.eof)) then str=str & "" end if end if response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf loop if ShowType=1 or ShowType=2 then if ShowMore="true" then if ClassID>0 then str="
more...
" else str="
more...
" end if response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf end if else str="" if ShowMore="true" then if ClassID>0 then str=str & "" else str=str & "" end if end if str=str & "
" end if if ShowType=1 or ShowType=2 then if ShowProperty="true" then if rs("OnTop")=true then str=str & "固顶文章 " elseif rs("Elite")=true then str=str & "推荐文章 " else str=str & "普通文章 " end if end if if ShowIncludePic="true" and rs("IncludePic")=true then str=str & "[图文]" end if if ShowClassName="true" then str=str & "[" & rs("ClassName") & "]" str=str & "" else str=str & "" end if str=str & Topic & "" else if ShowClassName="true" then str=str & "[" & rs("ClassName") & "]" str=str & "" else str=str & "" end if FileType=right(lcase(rs("DefaultPicUrl")),3) if FileType="swf" then str=str & "" elseif fileType="jpg" or fileType="bmp" or fileType="png" or fileType="gif" then str=str & "" else str=str & "" end if str=str & Topic & "" end if if ShowAuthor="true" or ShowUpdateTime="true" or ShowHits="true" then str=str & " (" if ShowAuthor="true" then if AuthorEmail="" then str=str & AuthorName else str=str & "" & AuthorName & "" end if end if if ShowUpdateTime="true" then if ShowAuthor="true" then str=str & "," end if if CDate(FormatDateTime(rs("UpdateTime"),2))=date() then str=str & "" else str=str & "" end if str=str & FormatDateTime(rs("UpdateTime"),1) & "" end if if ShowHits="true" then if ShowAuthor="true" or ShowUpdateTime="true" then str=str & "," end if str=str & rs("Hits") end if str=str & ")" end if if ShowHot="true" and rs("Hits")>=HitsOfHot then str=str & "热点文章" end if if ShowType=1 then str=str & "
" elseif ShowType=2 then str=str & "
" & left(replace(replace(replace(nohtml(rs("content")),chr(34),""),chr(10),"\n"),chr(13),"\n"),ContentMaxLen) & "……
" elseif ShowType=3 then str=str & "
" & left(replace(replace(replace(nohtml(rs("content")),chr(34),""),chr(10),"\n"),chr(13),"\n"),ContentMaxLen) & "……
更多……
更多……
" response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf end if end if rs.close set rs=nothing call CloseConn() %>