官方首页 | 无图版 | BBS首页
PJBlog3 2.8.5.157 新版发布 下载|升级(2008.8.26) 大话PJ3 | PJ3评测反馈 | PJ3发展建议 PJ纪念版T-shirt设计大赛投票结束大奖揭晓! PJ3内测团队主创人员身份,性格,特点吐血大曝光
PJBlog技术支持论坛使用问题总索引 PJ-Blog 3 斑竹日志 【独家】我使用过的三种空间,与客服的精彩故事 Z-Blog,Wordpress,Bo-Blog转换到PJBlog
发新话题
打印

调用方法┊PJBLOG首页调用

本主题由 嵘心天涯 于 2007-1-28 17:47 设置高亮

调用方法┊PJBLOG首页调用

针对原作者的做了如下修改:

添加调用几条记录 : topLen
修改了链接样式
修复了置顶贴子不能调用的问题.

效果如下:



附件下载:
点击下载此文件


源代码:


<!--#include file="const.asp" -->
<!--#include file="conn.asp" -->
<!--#include file="common/cache.asp" -->
<!--#include file="common/function.asp" -->
<!--#include file="common/ubbcode.asp" -->
<%
'==================================================================================================
'File name: topblog.asp
'首页调用文件
'原文更新时间: 2005-12-25
'清风修改时间: 2006-09-22
'QQ: 110125707 MSN: anwellsz@msn.com  Blog.Wind88.Net

'showType 输出类型,类型有五种
'留空 = [分类]标题+作者
'1 = [分类]标题+日期
'2 = 标题+作者
'3 = 标题+日期
'4 = 标题
'titleLength 标题长度
'authorLength 作者名称长度
'topLen 调用几条记录
'示例: <script language="javascript" src="你的网址/topblog.asp?showtype=4&TopLen=7&titleLength=50">
'==================================================================================================

getInfo(1)
  
Response.Charset = "UTF-8"
Response.Expires=60

Dim cate_ID,FeedCate,FeedTitle,memName,FeedRows
Dim showType,titleLength,authorLength,topLen

cate_ID=CheckStr(Request.QueryString("cateID"))

showType=Request.QueryString("showType")
titleLength=Request.QueryString("titleLength")
authorLength=Request.QueryString("authorLength")
topLen = Request.QueryString("topLen")
If Not isinteger(topLen) Then topLen = 10

if IsInteger(titleLength)=false then titleLength=20
if IsInteger(authorLength)=false then authorLength=6   

FeedCate=False

IF IsInteger(cate_ID) = False Then
    SQL="Select TOP "&topLen&" L.log_ID,L.log_Title,l.log_Author,L.log_PostTime,C.cate_Name,C.cate_ID,log_IsTop FROM blog_Content AS L,blog_Category AS C Where C.cate_ID=L.log_cateID AND L.log_IsShow=true AND L.log_IsDraft=false and C.cate_Secret=false orDER BY log_IsTop,log_PostTime DESC"
Else
    SQL="Select TOP "&topLen&" L.log_ID,L.log_Title,l.log_Author,L.log_PostTime,C.cate_Name,C.cate_ID,log_IsTop FROM blog_Content AS L,blog_Category AS C Where log_cateID="&cate_ID&" AND C.cate_ID=L.log_cateID AND L.log_IsShow=true AND L.log_IsDraft=false and C.cate_Secret=false orDER BY log_IsTop,log_PostTime DESC"
    FeedCate=True
End If
Dim RS,DisIMG,i
Set RS=Conn.ExeCute(SQL)
if RS.EOF or RS.BOF then
    ReDim FeedRows(0,0)
else
   if FeedCate then FeedTitle=SiteName & " - " & RS("cate_Name")
    FeedRows=RS.getrows()
end if
RS.close
set RS=nothing
Conn.Close
Set Conn=Nothing

if ubound(FeedRows,1)=0 then
            %>
            document.write ("没有找到任何日志")
            <%
else
    for i=0 to ubound(FeedRows,2)
         select case showType     
             case 1:
                %>              
                    document.write ("<div><span style=\"float:right\"><%=DateToStr(FeedRows(3,i),"Y-m-d")%></span>[<a href=\"<%=SiteURL&"default.asp?cateID="&FeedRows(5,i)%>\" target=\"_blank\"><%=toUnicode(FeedRows(4,i))%></a>]<a href=\"<%=SiteURL&"default.asp?id="&FeedRows(0,i)%>\" target=\"_blank\" title=\"<%=toUnicode(FeedRows(1,i))%>\"><%=toUnicode(CutStr(FeedRows(1,i),titleLength))%></a></div>")
                <%                 
             case 2:
                %>              
                    document.write ("<div><span style=\"float:right\"><a href=\"<%=SiteURL%>\" title=\"<%=toUnicode(FeedRows(2,i))%>\"><%=toUnicode(CutStr(FeedRows(2,i),authorLength))%></a></span><a href=\"<%=SiteURL&"default.asp?id="&FeedRows(0,i)%>\" target=\"_blank\" title=\"<%=toUnicode(FeedRows(1,i))%>\"><%=toUnicode(CutStr(FeedRows(1,i),titleLength))%></a></div>")
                <%                 
             case 3:
                %>              
                    document.write ("<div><span style=\"float:right\"><%=DateToStr(FeedRows(3,i),"Y-m-d")%></span><a href=\"<%=SiteURL&"default.asp?id="&FeedRows(0,i)%>\" target=\"_blank\" title=\"<%=toUnicode(FeedRows(1,i))%>\"><%=toUnicode(CutStr(FeedRows(1,i),titleLength))%></a></div>")
                <%        
             case 4:
                %>              
                    document.write ("<div> <a href=\"<%=SiteURL&"default.asp?id="&FeedRows(0,i)%>\" target=\"_blank\" title=\"<%=toUnicode(FeedRows(1,i))%>\" style=\"color:#0469C4;TEXT-DECORATION: underline\"><%=toUnicode(CutStr(FeedRows(1,i),titleLength))%></a></div>")
                <%   
                case else:
                %>              
                    document.write ("<div><span style=\"float:right\"><a href=\"<%=SiteURL%>\" title=\"<%=toUnicode(FeedRows(2,i))%>\"><%=toUnicode(CutStr(FeedRows(2,i),authorLength))%></a></span>[<a href=\"<%=SiteURL&"default.asp?cateID="&FeedRows(5,i)%>\" target=\"_blank\"><%=toUnicode(FeedRows(4,i))%></a>]<a href=\"<%=SiteURL&"default.asp?id="&FeedRows(0,i)%>\" target=\"_blank\" title=\"<%=toUnicode(FeedRows(1,i))%>\"><%=toUnicode(CutStr(FeedRows(1,i),titleLength))%></a></div>")
                <%         
         end select

    next
end if


function toUnicode(str) 'To Unicode
    dim i, unicodeF, getUnicode
    for i=1 to len(str)
        unicodeF=Mid(str,i,1)
        getUnicode=getUnicode & chr(38) & chr(35) & chr(120) & Hex(ascw(unicodeF)) & chr(59)
    next
    toUnicode=getUnicode
end function
%>

[ 本帖最后由 嵘心天涯 于 2007-1-28 17:45 编辑 ]

TOP

呵呵,支持一下

TOP

版主够快的啊,我刚放上去就回复了

谢谢支持

TOP

咋用啊!

TOP

把本文的附件下载,上传到你的博客空间即可.

在你要显示博客首页调用的地方:
加入如下代码即可


<script language="javascript" src="你的网址/topblog.asp?showtype=4&TopLen=7&titleLength=50">

TOP

先收藏了,以后用。

怪了,怎么找不到收藏帖子的地方
[quote]≡=-隐博-=≡[/quote]

TOP

有没有栏目调用的代码啊,我想进行栏目调用

TOP

可以的,我稍后改正一下贴出!

TOP

能在首页调用TAG吗?

呵呵,不错,喜欢,准备在首页用,但要是能调用TAGS那就更好了
看看我的PJBLOG,呵呵
http://www.lovetian.com

TOP

这个要加精

www.pjer.cn

TOP

发新话题