07-08
13

首页调用日志:分类日志、最新日志、单个日志

<%Newcate(int)%>每类中日志
<%One_art(int)%>单独日志
<%New_art()%>最新日志

<%
'one 单个日志
Sub One_art(ID)
LogID=int(ID)
Dim RSn,row,Newarticle,LogID
Newarticle = "<table width=99% border=0 cellpadding=0 cellspacing=0>"
    row=0
        Set RSn=Server.CreateObject("Adodb.RecordSet")
        SQL="Select * FROM blog_Content AS L  where L.log_ID="&LogID&" orDER BY log_ID DESC"
        
        RSn.Open SQL,Conn,1,1
        SQLQueryNums=SQLQueryNums+1
        If RSn.Eof And RSn.Bof Then
            Response.Write("None")
        Else
            Do While Not RSn.Eof
            
Newarticle = Newarticle & "<div class=""Content""><div class=""ContentTitle""><strong>"&RSn("log_Title")&"</strong></div>"
Newarticle = Newarticle & "<div class=""commentcontent"">     "&Left(RSn("log_Content"),21)&"...     "

              RSn.Movenext
              row=row+1
              if row=10 then
                Exit do
              end if
            Loop
        End If
        RSn.Close
        Set RSn=Nothing
Newarticle = Newarticle & "<a href=article.asp?id="&LogID&" target=_self><img src=images/temp/more.gif border=0 alt=more></a></div></div>"
response.write Newarticle
End sub

'分类中日志
sub Newcate(Ord)
    dim CateOrd,NewcateStr,RS,CateID
    CateOrd=int(Ord)    
    Set RS=Server.CreateObject("Adodb.Recordset")
    SQL="Select top 10 L.log_ID,L.log_Title,L.log_Content,L.log_PostTime,L.log_IsTop,C.cate_ID,C.cate_Name FROM blog_Content AS L,blog_Category AS C Where log_CateID=cate_ID AND cate_Order="&CateOrd&" order by log_IsTop Asc, log_ID desc"
    RS.Open SQL,CONN,1,1          
NewcateStr = "<div class=""Content NewContent""><div class=""Content-top""><div class=""ContentLeft""></div><div class=""ContentRight""></div><h1 class=""ContentTitle""><strong>"&RS("cate_Name")&"</strong></h1>"
CateID=RS("cate_ID")
NewcateStr = NewcateStr & "</div><div class=""NewBody""><table width=99% border=0 cellpadding=0 cellspacing=0>"
    do while not RS.eof
NewcateStr = NewcateStr & "<tr><td class=""newline""><a  href=article.asp?id="& RS("log_ID") &" target=_self>"
        if RS("log_IsTop") = True then
NewcateStr = NewcateStr & "<img src=images/temp/top.gif border=0 alt=置顶标志 style=""padding-right:3px"">"
        else
NewcateStr = NewcateStr & "♀ "
        end if
        if len(RS("log_Title"))>21 then
NewcateStr = NewcateStr & Left(RS("log_Title"),21) & "..."            
        else
NewcateStr = NewcateStr &  RS("log_Title")
        end if
        if DateDiff("h",RS("log_PostTime"),Now)<24 then
NewcateStr = NewcateStr & ""
        end if
NewcateStr = NewcateStr & "</a></td><td class=""newline"" width=50>"&month(RS("log_PostTime"))&"月"&day(RS("log_PostTime"))&"月""</td></tr>"
    RS.movenext
    loop
    RS.close
    Set RS=nothing
NewcateStr = NewcateStr & "<tr><td></td><td><a href=default.asp?cateID="&CateID&" target=_self><img src=images/temp/more.gif border=0 alt=more></a></td></tr></table></div></div>"
    response.write NewcateStr
end sub
%>

<%
'最新日志
Sub New_art()
Dim RSn,row,Newarticle
Newarticle = "<table width=99% border=0 cellpadding=0 cellspacing=0>"
    row=0
        Set RSn=Server.CreateObject("Adodb.RecordSet")
        SQL="Select TOP 10 L.log_Weather,L.log_CateID,L.log_ID,L.log_Title,L.log_ViewNums,C.cate_Name FROM blog_Content AS L,blog_Category AS C where C.cate_ID=L.log_CateID orDER BY log_ViewNums DESC"
        RSn.Open SQL,Conn,1,1
        SQLQueryNums=SQLQueryNums+1
        If RSn.Eof And RSn.Bof Then
            Response.Write("None")
        Else
            Do While Not RSn.Eof
Newarticle = Newarticle & "<tr><td class=""newline""><img src=images/weather/hn2_"&RSn("log_Weather")&".gif align=absmiddle>【<a href='default.asp?CateID="&RSn("log_CateID")&"'>"& RSn("cate_Name") &"</a>】<a target=_self href=""article.asp?id="&RSn("log_ID")&""">"&HTMLEncode(cutStr(RSn("log_Title"),21))&"</a></td><td class=""newline"" width=44>"& RSn("log_ViewNums") &"</td></tr>"
              RSn.Movenext
              row=row+1
              if row=10 then
                Exit do
              end if
            Loop
        End If
        RSn.Close
        Set RSn=Nothing
Newarticle = Newarticle & "<tr><td></td><td><a href=default.asp target=_self><img src=images/temp/more.gif border=0 alt=more></a></td></tr></table>"
response.write Newarticle
End sub
%>

文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 0 | 引用: 0 | 查看次数: 1347
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 关闭