首页 » Blog » 博客相关 ✿ weblog » 浏览内容

V2.7 FCK实现日志分页功能

2008-03-31 11:49 1164 0 发表评论

11-1.FCK模式下实现日志分页功能
有时候我们可能会在自己的博客上转载一些比较长的文章,从头看到脚的感觉真的是难过啊。一个实现单篇日志也能分页的功能,

因为PJBlog使用的FCK版本过旧,FCK新版本2.5功能十分强大,于是把原PJ的FCKeditor文件夹删除掉后,把2.5新版本下载后放置在PJ根目录下,也就是原FCK原文件夹的位置上。即可。

现在开始添加分页功能。
要修改的文件有:class/cls_article.asp
                         FCKeditor编辑器中几个文件。
注意pagesplit和xx中间的√在文件里是要去掉的
以下我用绿色显示要去掉的地方

class/cls_article.asp(以修改为相关日志的文件为修改对象)
查找:(第143行)

response.write (highlight(UnCheckStr(log_ViewArr(8,0)),keyword))

在其代码前添加“'”然后在后面添加以下代码:

'=======内分页程序============
        dim arrcontent,page,pagelist,content,pagecounter,x,xx
        content=highlight(UnCheckStr(log_ViewArr(8,0)),keyword)
        If InStr(1,cstr(content),"[pagesplit√xx]",1)<>0 Then
        ArrContent=Split(content,"[pagesplit√xx]")
        PageCounter=UBound(ArrContent)
        Page=Request.QueryString("Page")
        If isnumeric(Page)=false Then Page=1
        If Page<1 Then Page=1
        If Page-1>PageCounter Then Page=1
        For x=1 To PageCounter+1
        xx=x
        If CInt(Page)=x Then xx="<font style='color:red;font-weight:bold'>"&x&"</font>"
        PageList=PageList&" "&"<a href='?id="&logID&"&Page="&x&"' _fcksavedurl='?id="&logID&"&Page="&x&"'>["&xx&"]</a>"
        Next
        content=ArrContent(Page-1)&"<FCK:hr /><div align='center' style='font-size:12px'>"&pagelist&"</div>"
        End If
        '=======内分页程序结束========
        response.write (content)

这时使用FCK模式发表日志,我们插入分页符之后会发现
旧版本插入分页符后的源代码为:

<p><font face="Arial"><span style="page-break-after: always">[pagesplit√xx]</span>

新版本插入分页符后的源代码为:

<div style="page-break-after: always"><span style="display: none"> </span></div>

因为原PJ使用的FCK不是我们替换的新版本,所以现在要修改FCK里的几个文件。打开
FCKeditor \editor\js\fckeditorcode_gecko.js
FCKeditor \editor\js\fckeditorcode_ie.js
找到以下代码:(ctrl+F)

e=FCK.EditorDocument.createElement('DIV');e.style.pageBreakAfter='always';e.innerHTML='<span style="DISPLAY:none">& nbsp;</span>'

替换成

e=FCK.EditorDocument.createElement('span');e.style.pageBreakAfter='always';e.innerHTML='[pagesplit√xx]'

这样FCK模式下的分页符,即可以正常使用了。

11-2.UBB模式下实现分页符
要说明的一点是在FCK实现分页的方法基础上实现插入分页的。
要修改的文件有:
class/cls_article.asp
common/UBBCode_Gecko.js
common/UBBCode_ie.js
common/UBBconfig.asp
注意pagesplit和xx中间的√在文件里是要去掉的
以下我用绿色显示要去掉的地方

打开class/cls_article.asp,在已安装了FCK模式的分页功能后,
找到以下代码:(第141行)(以修改为相关日志之后添加了FCK分页的文件为修改对象)

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_V
iewArr(11,0),5,1))),keyword))

替换为:

'=======UBB模式内分页程序============
        dim arrcontent,page,pagelist,content,pagecounter,x,xx
        content=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)
        If InStr(1,cstr(content),"[pagesplit√xx]",1)<>0 Then
        ArrContent=Split(content,"[pagesplit√xx]")
        PageCounter=UBound(ArrContent)
        Page=Request.QueryString("Page")
        If isnumeric(Page)=false Then Page=1
        If Page<1 Then Page=1
        If Page-1>PageCounter Then Page=1
        For x=1 To PageCounter+1
        xx=x
        If CInt(Page)=x Then xx="<font style='color:red;font-weight:bold'>"&x&"</font>"
        PageList=PageList&" "&"<a href='?id="&logID&"&Page="&x&"' _fcksavedurl='?id="&logID&"&Page="&x&"'>["&xx&"]</a>"
        Next
        content=ArrContent(Page-1)&"<FCK:hr /><div align='center' style='font-size:12px'>"&pagelist&"</div>"
        End If
        '=======内分页程序结束========
        response.write (content)

然后将以下代码删除<当初实现FCK模式分页加入的代码超始段>

dim arrcontent,page,pagelist,content,pagecounter,x,xx

这一段代码在'=======UBB模式内分页程序============的下面

打开common/UBBCode_Gecko.js
以及common/UBBCode_ie.js
在这两个文件最尾部添加以下代码:

function UBB_pagesplitxx(){
        if (EditMethod=="normal")
        {
        AddText("[pagesplit√xx]")
        }
        if (EditMethod=="expert")
        {
        AddText("[pagesplit√xx]")
        }
        }

再打开common/UBBconfig.asp
找到以下代码:(第14行)

"link,mail,image,insertunorderedlist,quote,hidden,code,html"

替换为:

"link,mail,image,insertunorderedlist,quote,hidden,code,html,pagesplitxx"

再查找以下代码:(第123行)

function Tip(str)
Select Case str

在这段代码后面添加以下代码:

case "pagesplitxx":
   Tip="插入分页符"

最后把分页符标签图pagesplitxx.gif放进Blog根目录下images里面,以及你皮肤UBB/icon目录里面。

评论 共0条 (RSS 2.0) 发表评论

  1. 暂无评论,快抢沙发吧。

发表评论

联系我 Contact Me

十一假期后,会间接性整顿博客。如果发现有图片叉叉地,版面凌乱地,文字模糊不清地、相片太可爱地、请告之站长。绝对有惊喜!!……另外,给大家推荐一部好片:《三个傻瓜大闹宝莱坞》,站长最近比较痴迷男主角。~(≧▽≦)/~。
回到页首