官方首页 | 无图版 | BBS首页
PJBlog3 2.8.5.157 新版发布 下载|升级(2008.8.26) 来给PJ3提提发展建议 2008版 PJHOME 珍藏/纪念版官方T恤 正式发布! PJ3内测团队主创人员身份,性格,特点吐血大曝光
PJBlog技术支持论坛使用问题总索引 PJ-Blog 3 斑竹日志 【独家】我使用过的三种空间,与客服的精彩故事 Z-Blog,Wordpress,Bo-Blog转换到PJBlog
 32 1234
发新话题
打印

为你的PJBlog加上文章分页功能

本主题由 thomas 于 2007-2-7 16:39 解除高亮

为你的PJBlog加上文章分页功能

Author:Iceworld
Date:2006-4-19
参考了《CMS1.0文章分页功能》,对作者表示感谢。
更改主要分成三个大步骤,数据库部分,前台显示部分,后台添加部分。
一:数据库部分
该部分的主要作用是为数据库的日志内容表加上两个字段,分页类型和自动分页大概字符数目。
打开blogDB目录,把PBLog2.asp改名为PBLog2.mdb。打开PBLog2.mdb中的blog_Content表,新加两个字段PaginationType(分页类型,数字,0表示不分页,1表示自动分页,2表示手动分页)和MaxCharPerPage(自动分页的大概字符,数字);然后把该表的所有该两个字段的值设置为0。把PBLog2.mdb改名为PBLog2.asp,这样数据库部分就算设计完毕了。

二:前台显示部分
第一步:
进入common文件夹,新建con_article.asp文件,内容如下:
复制内容到剪贴板
代码:
<%
'--------------自动分页代码开始-----------
sub ArticleContent()       
        select case log_ViewArr(20,0)
                case 0    '不分页显示
           if log_ViewArr(10,0)=1 then
                                response.write (highlight(UnCheckStr(UBBCode(HtmlEncode(log_ViewArr(8,0)),mid(log_ViewArr(11,0),1,1),mid(log_ViewArr(11,0),2,1),mid(log_ViewArr(11,0),3,1),mid(log_ViewArr(11,0),4,1),mid(log_ViewArr(11,0),5,1))),keyword))
                        else
                                response.write (highlight(UnCheckStr(log_ViewArr(8,0)),keyword))
                        end if                       
                case 1    '自动分页显示
                  call AutoPagination()
                case 2    '手动分页显示
                  call ManualPagination()
        end select
end sub

sub ManualPagination()   '手动分页显示
        dim strContent,CurrentPage,arrContent,pages,i
    if log_ViewArr(10,0)=1 then
                strContent=(highlight(UnCheckStr(UBBCode(HtmlEncode(log_ViewArr(8,0)),mid(log_ViewArr(11,0),1,1),mid(log_ViewArr(11,0),2,1),mid(log_ViewArr(11,0),3,1),mid(log_ViewArr(11,0),4,1),mid(log_ViewArr(11,0),5,1))),keyword))
        else
                strContent=(highlight(UnCheckStr(log_ViewArr(8,0)),keyword))
        end if
        'ContentLen=len(strContent)
        'response.Write(ContentLen)
        'response.End()
        CurrentPage=trim(request("ArticlePage"))
        if Instr(strContent,"我想要在这里分页")<=0 then
                response.write strContent
                response.write "<div align='right'><font color='red'><b>[1]</b></font></div>"
        else
                arrContent=split(strContent,"我想要在这里分页")

                pages=Ubound(arrContent)+1
                if CurrentPage="" then
                        CurrentPage=1
                else
                        CurrentPage=Cint(CurrentPage)
                end if
                if CurrentPage<1 then CurrentPage=1
                if CurrentPage>pages then CurrentPage=pages
               
                response.write arrContent(CurrentPage-1)

                response.write "<div align='right'><b>"
                if CurrentPage>1 then
                        response.write "<a href='?id="&id&"&ArticlePage="&CurrentPage-1&"'>上一页</a>&nbsp;&nbsp;"
                end if
                for i=1 to pages
                        if i=CurrentPage then
                                response.write "<font face=Arial color='red'>"&cstr(i)&"</font>&nbsp;"
                        else
                                response.write "<a href='?id="&id&"&ArticlePage="&i&"'><font face=Arial>["&i&"]</font></a>&nbsp;"
                        end if
                next
                if CurrentPage<pages then
                        response.write "&nbsp;<a href='?id="&id&"&ArticlePage="&CurrentPage+1&"'>下一页</a>"
                end if
                response.write "</b></div>"
               
        end if

end sub

sub AutoPagination() '自动分页显示
        dim strContent,ContentLen,CurrentPage,MaxCharPerPage,pages,lngBound,i,BeginPoint,EndPoint
        MaxCharPerPage=log_ViewArr(21,0)
        if log_ViewArr(10,0)=1 then
                strContent=(highlight(UnCheckStr(UBBCode(HtmlEncode(log_ViewArr(8,0)),mid(log_ViewArr(11,0),1,1),mid(log_ViewArr(11,0),2,1),mid(log_ViewArr(11,0),3,1),mid(log_ViewArr(11,0),4,1),mid(log_ViewArr(11,0),5,1))),keyword))
        else
                strContent=(highlight(UnCheckStr(log_ViewArr(8,0)),keyword))
        end if

          ContentLen=len(log_ViewArr(8,0))
        'response.Write (strContent)
        'response.End()
        CurrentPage=trim(request("ArticlePage"))
        if ContentLen<=MaxCharPerPage then
                response.Write(strContent)
                response.write "<div align='right'><font color='red'><b>[1]</b></font></div>"
        else
                if CurrentPage="" then
                        CurrentPage=1
                else
                        CurrentPage=Cint(CurrentPage)
                end if
                pages=ContentLen\MaxCharPerPage
                if MaxCharPerPage*pages<ContentLen then
                        pages=pages+1
                end if
        lngBound=ContentLen          '最大误差范围
                if CurrentPage<1 then CurrentPage=1
                if CurrentPage>pages then CurrentPage=pages

                dim lngTemp
                dim lngTemp1,lngTemp1_1,lngTemp1_2,lngTemp1_1_1,lngTemp1_1_2,lngTemp1_1_3,lngTemp1_2_1,lngTemp1_2_2,lngTemp1_2_3
                dim lngTemp2,lngTemp2_1,lngTemp2_2,lngTemp2_1_1,lngTemp2_1_2,lngTemp2_2_1,lngTemp2_2_2
                dim lngTemp3,lngTemp3_1,lngTemp3_2,lngTemp3_1_1,lngTemp3_1_2,lngTemp3_2_1,lngTemp3_2_2
                dim lngTemp4,lngTemp4_1,lngTemp4_2,lngTemp4_1_1,lngTemp4_1_2,lngTemp4_2_1,lngTemp4_2_2
                dim lngTemp5,lngTemp5_1,lngTemp5_2
                dim lngTemp6,lngTemp6_1,lngTemp6_2
               
                if CurrentPage=1 then
                        BeginPoint=1
                else
                        BeginPoint=MaxCharPerPage*(CurrentPage-1)+1
                       
                        lngTemp1_1_1=instr(BeginPoint,strContent,"</table>",1)
                        lngTemp1_1_2=instr(BeginPoint,strContent,"</TABLE>",1)
                        lngTemp1_1_3=instr(BeginPoint,strContent,"</Table>",1)
                        if lngTemp1_1_1>0 then
                                lngTemp1_1=lngTemp1_1_1
                        elseif lngTemp1_1_2>0 then
                                lngTemp1_1=lngTemp1_1_2
                        elseif lngTemp1_1_3>0 then
                                lngTemp1_1=lngTemp1_1_3
                        else
                                lngTemp1_1=0
                        end if
                                                       
                        lngTemp1_2_1=instr(BeginPoint,strContent,"<table",1)
                        lngTemp1_2_2=instr(BeginPoint,strContent,"<TABLE",1)
                        lngTemp1_2_3=instr(BeginPoint,strContent,"<Table",1)
                        if lngTemp1_2_1>0 then
                                lngTemp1_2=lngTemp1_2_1
                        elseif lngTemp1_2_2>0 then
                                lngTemp1_2=lngTemp1_2_2
                        elseif lngTemp1_2_3>0 then
                                lngTemp1_2=lngTemp1_2_3
                        else
                                lngTemp1_2=0
                        end if
                       
                        if lngTemp1_1=0 and lngTemp1_2=0 then
                                lngTemp1=BeginPoint
                        else
                                if lngTemp1_1>lngTemp1_2 then
                                        lngtemp1=lngTemp1_2
                                else
                                        lngTemp1=lngTemp1_1+8
                                end if
                        end if

                        lngTemp2_1_1=instr(BeginPoint,strContent,"</p>",1)
                        lngTemp2_1_2=instr(BeginPoint,strContent,"</P>",1)
                        if lngTemp2_1_1>0 then
                                lngTemp2_1=lngTemp2_1_1
                        elseif lngTemp2_1_2>0 then
                                lngTemp2_1=lngTemp2_1_2
                        else
                                lngTemp2_1=0
                        end if
                                               
                        lngTemp2_2_1=instr(BeginPoint,strContent,"<p",1)
                        lngTemp2_2_2=instr(BeginPoint,strContent,"<P",1)
                        if lngTemp2_2_1>0 then
                                lngTemp2_2=lngTemp2_2_1
                        elseif lngTemp2_2_2>0 then
                                lngTemp2_2=lngTemp2_2_2
                        else
                                lngTemp2_2=0
                        end if
                       
                        if lngTemp2_1=0 and lngTemp2_2=0 then
                                lngTemp2=BeginPoint
                        else
                                if lngTemp2_1>lngTemp2_2 then
                                        lngtemp2=lngTemp2_2
                                else
                                        lngTemp2=lngTemp2_1+4
                                end if
                        end if

                        lngTemp3_1_1=instr(BeginPoint,strContent,"</ur>",1)
                        lngTemp3_1_2=instr(BeginPoint,strContent,"</UR>",1)
                        if lngTemp3_1_1>0 then
                                lngTemp3_1=lngTemp3_1_1
                        elseif lngTemp3_1_2>0 then
                                lngTemp3_1=lngTemp3_1_2
                        else
                                lngTemp3_1=0
                        end if
                       
                        lngTemp3_2_1=instr(BeginPoint,strContent,"<ur",1)
                        lngTemp3_2_2=instr(BeginPoint,strContent,"<UR",1)
                        if lngTemp3_2_1>0 then
                                lngTemp3_2=lngTemp3_2_1
                        elseif lngTemp3_2_2>0 then
                                lngTemp3_2=lngTemp3_2_2
                        else
                                lngTemp3_2=0
                        end if
                                       
                        if lngTemp3_1=0 and lngTemp3_2=0 then
                                lngTemp3=BeginPoint
                        else
                                if lngTemp3_1>lngTemp3_2 then
                                        lngtemp3=lngTemp3_2
                                else
                                        lngTemp3=lngTemp3_1+5
                                end if
                        end if
                       
                        if lngTemp1>lngTemp2 then
                                lngTemp=lngTemp2
                        else
                                lngTemp=lngTemp1
                        end if
                        if lngTemp<lngTemp3 then
                                lngTemp=lngTemp3
                        end if

                        if lngTemp>BeginPoint and lngTemp<=BeginPoint+lngBound then
                                BeginPoint=lngTemp
                        else
                                lngTemp4_1_1=instr(BeginPoint,strContent,"</li>",1)
                                lngTemp4_1_2=instr(BeginPoint,strContent,"</LI>",1)
                                if lngTemp4_1_1>0 then
                                        lngTemp4_1=lngTemp4_1_1
                                elseif lngTemp4_1_2>0 then
                                        lngTemp4_1=lngTemp4_1_2
                                else
                                        lngTemp4_1=0
                                end if
                               
                                lngTemp4_2_1=instr(BeginPoint,strContent,"<li",1)
                                lngTemp4_2_1=instr(BeginPoint,strContent,"<LI",1)
                                if lngTemp4_2_1>0 then
                                        lngTemp4_2=lngTemp4_2_1
                                elseif lngTemp4_2_2>0 then
                                        lngTemp4_2=lngTemp4_2_2
                                else
                                        lngTemp4_2=0
                                end if
                               
                                if lngTemp4_1=0 and lngTemp4_2=0 then
                                        lngTemp4=BeginPoint
                                else
                                        if lngTemp4_1>lngTemp4_2 then
                                                lngtemp4=lngTemp4_2
                                        else
                                                lngTemp4=lngTemp4_1+5
                                        end if
                                end if
                               
                                if lngTemp4>BeginPoint and lngTemp4<=BeginPoint+lngBound then
                                        BeginPoint=lngTemp4
                                else                                       
                                        lngTemp5_1=instr(BeginPoint,strContent,"<img",1)
                                        lngTemp5_2=instr(BeginPoint,strContent,"<IMG",1)
                                        if lngTemp5_1>0 then
                                                lngTemp5=lngTemp5_1
                                        elseif lngTemp5_2>0 then
                                                lngTemp5=lngTemp5_2
                                        else
                                                lngTemp5=BeginPoint
                                        end if
                                       
                                        if lngTemp5>BeginPoint and lngTemp5<BeginPoint+lngBound then
                                                BeginPoint=lngTemp5
                                        else
                                                lngTemp6_1=instr(BeginPoint,strContent,"<br>",1)
                                                lngTemp6_2=instr(BeginPoint,strContent,"<BR>",1)
                                                if lngTemp6_1>0 then
                                                        lngTemp6=lngTemp6_1
                                                elseif lngTemp6_2>0 then
                                                        lngTemp6=lngTemp6_2
                                                else
                                                        lngTemp6=0
                                                end if
                                       
                                                if lngTemp6>BeginPoint and lngTemp6<BeginPoint+lngBound then
                                                        BeginPoint=lngTemp6+4
                                                end if
                                        end if
                                end if
                        end if
                end if

                if CurrentPage=pages then
                        EndPoint=ContentLen
                else
                  EndPoint=MaxCharPerPage*CurrentPage
                  if EndPoint>=ContentLen then
                        EndPoint=ContentLen
                  else
                        lngTemp1_1_1=instr(EndPoint,strContent,"</table>",1)
                        lngTemp1_1_2=instr(EndPoint,strContent,"</TABLE>",1)
                        lngTemp1_1_3=instr(EndPoint,strContent,"</Table>",1)
                        if lngTemp1_1_1>0 then
                                lngTemp1_1=lngTemp1_1_1
                        elseif lngTemp1_1_2>0 then
                                lngTemp1_1=lngTemp1_1_2
                        elseif lngTemp1_1_3>0 then
                                lngTemp1_1=lngTemp1_1_3
                        else
                                lngTemp1_1=0
                        end if
                                                       
                        lngTemp1_2_1=instr(EndPoint,strContent,"<table",1)
                        lngTemp1_2_2=instr(EndPoint,strContent,"<TABLE",1)
                        lngTemp1_2_3=instr(EndPoint,strContent,"<Table",1)
                        if lngTemp1_2_1>0 then
                                lngTemp1_2=lngTemp1_2_1
                        elseif lngTemp1_2_2>0 then
                                lngTemp1_2=lngTemp1_2_2
                        elseif lngTemp1_2_3>0 then
                                lngTemp1_2=lngTemp1_2_3
                        else
                                lngTemp1_2=0
                        end if
                       
                        if lngTemp1_1=0 and lngTemp1_2=0 then
                                lngTemp1=EndPoint
                        else
                                if lngTemp1_1>lngTemp1_2 then
                                        lngtemp1=lngTemp1_2-1
                                else
                                        lngTemp1=lngTemp1_1+7
                                end if
                        end if

                        lngTemp2_1_1=instr(EndPoint,strContent,"</p>",1)
                        lngTemp2_1_2=instr(EndPoint,strContent,"</P>",1)
                        if lngTemp2_1_1>0 then
                                lngTemp2_1=lngTemp2_1_1
                        elseif lngTemp2_1_2>0 then
                                lngTemp2_1=lngTemp2_1_2
                        else
                                lngTemp2_1=0
                        end if
                                               
                        lngTemp2_2_1=instr(EndPoint,strContent,"<p",1)
                        lngTemp2_2_2=instr(EndPoint,strContent,"<P",1)
                        if lngTemp2_2_1>0 then
                                lngTemp2_2=lngTemp2_2_1
                        elseif lngTemp2_2_2>0 then
                                lngTemp2_2=lngTemp2_2_2
                        else
                                lngTemp2_2=0
                        end if
                       
                        if lngTemp2_1=0 and lngTemp2_2=0 then
                                lngTemp2=EndPoint
                        else
                                if lngTemp2_1>lngTemp2_2 then
                                        lngTemp2=lngTemp2_2-1
                                else
                                        lngTemp2=lngTemp2_1+3
                                end if
                        end if

                        lngTemp3_1_1=instr(EndPoint,strContent,"</ur>",1)
                        lngTemp3_1_2=instr(EndPoint,strContent,"</UR>",1)
                        if lngTemp3_1_1>0 then
                                lngTemp3_1=lngTemp3_1_1
                        elseif lngTemp3_1_2>0 then
                                lngTemp3_1=lngTemp3_1_2
                        else
                                lngTemp3_1=0
                        end if
                       
                        lngTemp3_2_1=instr(EndPoint,strContent,"<ur",1)
                        lngTemp3_2_2=instr(EndPoint,strContent,"<UR",1)
                        if lngTemp3_2_1>0 then
                                lngTemp3_2=lngTemp3_2_1
                        elseif lngTemp3_2_2>0 then
                                lngTemp3_2=lngTemp3_2_2
                        else
                                lngTemp3_2=0
                        end if
                                       
                        if lngTemp3_1=0 and lngTemp3_2=0 then
                                lngTemp3=EndPoint
                        else
                                if lngTemp3_1>lngTemp3_2 then
                                        lngtemp3=lngTemp3_2-1
                                else
                                        lngTemp3=lngTemp3_1+4
                                end if
                        end if
                       
                        if lngTemp1>lngTemp2 then
                                lngTemp=lngTemp2
                        else
                                lngTemp=lngTemp1
                        end if
                        if lngTemp<lngTemp3 then
                                lngTemp=lngTemp3
                        end if

                        if lngTemp>EndPoint and lngTemp<=EndPoint+lngBound then
                                EndPoint=lngTemp
                        else
                                lngTemp4_1_1=instr(EndPoint,strContent,"</li>",1)
                                lngTemp4_1_2=instr(EndPoint,strContent,"</LI>",1)
                                if lngTemp4_1_1>0 then
                                        lngTemp4_1=lngTemp4_1_1
                                elseif lngTemp4_1_2>0 then
                                        lngTemp4_1=lngTemp4_1_2
                                else
                                        lngTemp4_1=0
                                end if
                               
                                lngTemp4_2_1=instr(EndPoint,strContent,"<li",1)
                                lngTemp4_2_1=instr(EndPoint,strContent,"<LI",1)
                                if lngTemp4_2_1>0 then
                                        lngTemp4_2=lngTemp4_2_1
                                elseif lngTemp4_2_2>0 then
                                        lngTemp4_2=lngTemp4_2_2
                                else
                                        lngTemp4_2=0
                                end if
                               
                                if lngTemp4_1=0 and lngTemp4_2=0 then
                                        lngTemp4=EndPoint
                                else
                                        if lngTemp4_1>lngTemp4_2 then
                                                lngtemp4=lngTemp4_2-1
                                        else
                                                lngTemp4=lngTemp4_1+4
                                        end if
                                end if
                               
                                if lngTemp4>EndPoint and lngTemp4<=EndPoint+lngBound then
                                        EndPoint=lngTemp4
                                else                                       
                                        lngTemp5_1=instr(EndPoint,strContent,"<img",1)
                                        lngTemp5_2=instr(EndPoint,strContent,"<IMG",1)
                                        if lngTemp5_1>0 then
                                                lngTemp5=lngTemp5_1-1
                                        elseif lngTemp5_2>0 then
                                                lngTemp5=lngTemp5_2-1
                                        else
                                                lngTemp5=EndPoint
                                        end if
                                       
                                        if lngTemp5>EndPoint and lngTemp5<EndPoint+lngBound then
                                                EndPoint=lngTemp5
                                        else
                                                lngTemp6_1=instr(EndPoint,strContent,"<br>",1)
                                                lngTemp6_2=instr(EndPoint,strContent,"<BR>",1)
                                                if lngTemp6_1>0 then
                                                        lngTemp6=lngTemp6_1+3
                                                elseif lngTemp6_2>0 then
                                                        lngTemp6=lngTemp6_2+3
                                                else
                                                        lngTemp6=EndPoint
                                                end if
                                       
                                                if lngTemp6>EndPoint and lngTemp6<EndPoint+lngBound then
                                                        EndPoint=lngTemp6
                                                end if
                                        end if
                                end if
                        end if
                  end if
                end if
                response.write mid(strContent,BeginPoint,EndPoint-BeginPoint+1)
               
                response.write "<div align='right'><b>"
                if CurrentPage>1 then
                        response.write "<a href='?id="&id&"&ArticlePage="&CurrentPage-1&"'>上一页</a>&nbsp;&nbsp;"
                end if
                for i=1 to pages
                        if i=CurrentPage then
                                response.write "<font face=Arial color='red'>"&cstr(i)&"</font>&nbsp;"
                        else
                                response.write "<a href='?id="&id&"&ArticlePage="&i&"'><font face=Arial>["&i&"]</font></a>&nbsp;"
                        end if
                next
                if CurrentPage<pages then
                        response.write "&nbsp;<a href='?id="&id&"&ArticlePage="&CurrentPage+1&"'>下一页</a>"
                end if
                response.write "</b></div>"
        end if
end sub
'--------------自动分页代码结束-----------
%>
[提示:你可先修改部分代码,再按运行]
下载后请改名为con_article.asp
第二步:
打开class文件夹中的cls_article.asp找到:
keyword=CheckStr(Request.QueryString("keyword"))
if log_ViewArr(10,0)=1 then
response.write (highlight(UnCheckStr(UBBCode(HtmlEncode(log_ViewArr(8,0)),mid(log_ViewArr(11,0),1,1),mid(log_ViewArr(11,0),2,1),mid(log_ViewArr(11,0),3,1),mid(log_ViewArr(11,0),4,1),mid(log_ViewArr(11,0),5,1))),keyword))
else
response.write (highlight(UnCheckStr(log_ViewArr(8,0)),keyword))
end if
把上面的代码更改为:
keyword=CheckStr(Request.QueryString("keyword"))
call ArticleContent()
第三步:
找到根目录下面的article.asp,在第一行上加上:
<!--#include file="common/con_article.asp" -->
再找到:
SQL="Select top 1 log_ID,log_CateID,log_title,Log_IsShow,log_ViewNums,log_Author,log_comorder,log_DisComment,log_Content,log_PostTime,log_edittype,log_ubbFlags,log_CommNums,log_QuoteNums,log_weather,log_level,log_Modify,log_FromUrl,log_From,log_tag FROM blog_Content Where log_ID="&id&" and log_IsDraft=false"
更改为:
SQL="Select top 1 log_ID,log_CateID,log_title,Log_IsShow,log_ViewNums,log_Author,log_comorder,log_DisComment,log_Content,log_PostTime,log_edittype,log_ubbFlags,log_CommNums,log_QuoteNums,log_weather,log_level,log_Modify,log_FromUrl,log_From,log_tag,PaginationType,MaxCharPerPage FROM blog_Content Where log_ID="&id&" and log_IsDraft=false"
以后我们就可以很方便的通过log_ViewArr(20,0)和log_ViewArr(21,0)来调用分页类型和自动分页大概字符了。
打开数据库,随便更改几个分页类型,看看效果?


三:后台设计部分
1:添加日志界面部分
打开根目录下面的blogpost.asp,找到:
<tr>
<td align="right" valign="top" nowrap><span style="font-weight: bold">附件上传:</span></td>
<td colspan="2" align="left"><iframe src="attachment.asp" width="100%" height="24" frameborder="0" scrolling="no" border="0" frameborder="0"></iframe></td>
</tr>
在这一段上面加上:
<tr>
<td align="right" valign="top"><span style="font-weight: bold">分页方式:</span></td>
<td colspan="2" align="left"><select name="PaginationType" >
<option value="0">不分页</option>
<option value="1">自动分页</option>
<option value="2">手动分页</option>
</select> <strong><font color="#0000FF">注:</font></strong><font color="#0000FF">手动分页符标记为</font> <font color="#FF0000">我想要在这里分页</font></td>
</tr>
<tr>
<td align="right" valign="top"><span style="font-weight: bold">自动分页:</span></td>
<td colspan="2" align="left"><input name="MaxCharPerPage" type="text" value="2000" size="8" maxlength="8"> 自动分页时的每页大约字符数(包含HTML标记)</td>
</tr>


2:添加日志后台部分
同上,找到:
lArticle.logPublishTimeType = request.form("PubTimeType")
下面加上:
lArticle.PaginationType = int(request.form("PaginationType"))
lArticle.MaxCharPerPage = int(request.form("MaxCharPerPage"))
3:编辑日志界面部分
找到根目录下面的blogedit.asp,找到:
<tr>
<td align="right" valign="top" nowrap><span style="font-weight: bold">附件上传:</span></td>
<td colspan="2" align="left"><iframe src="attachment.asp" width="100%" height="24" frameborder="0" scrolling="no" border="0" frameborder="0"></iframe></td>
</tr>
在上面加上:
<tr>
<td align="right" valign="top"><span style="font-weight: bold">分页方式:</span></td>
<td colspan="2" align="left"><select name="PaginationType" >
<option value="0" <%if lArticle.PaginationType=0 then response.write "selected"%>>不分页</option>
<option value="1" <%if lArticle.PaginationType=1 then response.write "selected"%>>自动分页</option>
<option value="2" <%if lArticle.PaginationType=2 then response.write "selected"%>>手动分页</option>
</select> <strong><font color="#0000FF">注:</font></strong><font color="#0000FF">手动分页符标记为</font> <font color="#FF0000">我想要在这里分页</font></td>
</tr>
<tr>
<td align="right" valign="top"><span style="font-weight: bold">自动分页:</span></td>
<td colspan="2" align="left"><input name="MaxCharPerPage" type="text" value="<%=lArticle.MaxCharPerPage%>" size="8" maxlength="8"> 自动分页时的每页大约字符数(包含HTML标记)</td>
</tr>
4:编辑日志后台部分
同上,找到
lArticle.logPublishTimeType = request.form("PubTimeType")
在他下面加上:
lArticle.PaginationType = int(request.form("PaginationType"))
lArticle.MaxCharPerPage = int(request.form("MaxCharPerPage"))
5:公用部分
打开class/cls_logAction.asp
找到:
public logQuote,logMessage,logIntro,logIntroCustom,logTags,logPublishTimeType,logPubTime,logTrackback,logCommentCount,logQuoteCount,logViewCount
更改为:
public logQuote,logMessage,logIntro,logIntroCustom,logTags,logPublishTimeType,logPubTime,logTrackback,logCommentCount,logQuoteCount,logViewCount,MaxCharPerPage,PaginationType
找到类初始化里面的:
categoryID = 0
logTitle = ""
后面加上:
MaxCharPerPage = 2500
PaginationType = 0
找到postLog函数里面的:
weblog("log_edittype")=logEditType
weblog("log_comorder")=logCommentOrder
后面加上:
weblog("MaxCharPerPage")=MaxCharPerPage
weblog("PaginationType")=PaginationType
找到editLog函数里面的:
weblog("log_edittype")=logEditType
weblog("log_comorder")=logCommentOrder
后面加上:
weblog("MaxCharPerPage")=MaxCharPerPage
weblog("PaginationType")=PaginationType
找到getLog函数里面的:
sqlString="Select top 1 log_CateID,log_Author,log_Title,log_edittype,log_ubbFlags,log_Intro,log_weather,log_Level,log_comorder,log_DisComment,log_IsShow,log_IsTop,log_IsDraft,log_From,log_FromURL,log_Content,log_tag,log_PostTime,log_CommNums,log_QuoteNums,log_ViewNums FROM blog_Content Where log_ID="&id&""
更改为:
sqlString="Select top 1 log_CateID,log_Author,log_Title,log_edittype,log_ubbFlags,log_Intro,log_weather,log_Level,log_comorder,log_DisComment,log_IsShow,log_IsTop,log_IsDraft,log_From,log_FromURL,log_Content,log_tag,log_PostTime,log_CommNums,log_QuoteNums,log_ViewNums,PaginationType,MaxCharPerPage FROM blog_Content Where log_ID="&id&""
还是该函数里面的:
logQuoteCount = weblog("log_QuoteNums")
logViewCount = weblog("log_ViewNums")
后面加上PaginationType = weblog("PaginationType")
MaxCharPerPage = weblog("MaxCharPerPage")

至此,所有事情完毕!
四:后记
程序肯定还有很多的错误。以后有时间再改吧。列举备忘如下:
(1):添加或者编辑文章的时候必须有tag,不然不能正常添加或编辑
(2):手动分页标记为“我想要在这里分页”,你可以进入con_article.asp更改,以前用的是[NextPage],不过PJBlog好像对[]进行了过滤,正则表达式我看不懂。
(3):我是再关闭静态日志的情况下成功的,不知道打开了静态日志还能不能正常工作,不过有一点可以确认:我修改的这个里面静态日志里面肯定不可以分页。

希望有高人顺着这个思想,为PJBlog写个文章分页的插件。

首先申明:本人只提供思路,如果你想更改,请先备份。

[ 本帖最后由 iceworld 于 2006-4-19 09:43 编辑 ]

TOP

这个功能很实用的,但是楼主的方法实在太复杂了,不敢随便尝试。希望舜子早日把这个功能集成到程序中^_^

TOP

哈哈,支持一下楼主。有时间再试试

TOP

引用:
原帖由 happy86724 于 2006-4-19 17:16 发表
做个插件怎么样?
我试试
关键改了之后添加没有Tag的文章会不正常,很郁闷的很

TOP

非常不错.大家可以学习一下,这个是通用的.

TOP

我也强烈支持!
当初一直犹豫升级到PJ就是因为pj没有分页标签功能啊~~

TOP

实用的功能。
兔兔失业了......http://www.TTLL.org正式启用

决不回复任何无聊的帖子。

要无聊随你,忙着呢!

TOP

这个实用,早日搞成插件为好哦~~~

TOP

期待期待,这个是好东东啊

TOP

好东西要支持一下
欢迎访问:
Www.Zxl.Name

TOP

 32 1234
发新话题