jQuery+FCK编辑器+PHP实现文章分页代码

在fck中插入分页符如下图

文章分页代码-jquery 长文章分页">

分页代码

 

function pagebreak($content)
{
$content = $content;
$pattern = "/<div style="page-break-after: always"><span style="display: none"> </span></div>/";
$strsplit = preg_split($pattern, $content, -1, preg_split_no_empty);
$count = count($strsplit);
$outstr = "";
$i = 1;

if ($count > 1 ) {
$outstr = "<div id='page_break'>";
foreach($strsplit as $value) {
if ($i <= 1) {
$outstr .= "<div id='page_$i'>$value</div>";
} else {
$outstr .= "<div id='page_$i' class='collaps教程e'>$value</div>";
}
$i++;
}

$outstr .= "<div class='num'>";
for ($i = 1; $i <= $count; $i++) {
$outstr .= "<li>$i</li>";
}
$outstr .= "</div></div>";
return $outstr;
} else {
return $content;
}
}

jquery实现代码

 

$(document).ready(function(){
$('#page_break .num li:first').addclass('on');

$('#page_break .num li').click(function(){
//隐藏所有页内容
$("#page_break div[id^='page_']").hide();

//显示当前页内容。
if ($(this).hasclass('on')) {
$('#page_break #page_' + $(this).text()).show();
} else {
$('#page_break .num li').removeclass('on');
$(this).addclass('on');
$('#page_break #page_' + $(this).text()).fadein('normal');
}
});
});

css教程控制分页样式

 

#page_break {

}
#page_break .collapse {
display: none;
}
#page_break .num {
padding: 10px 0;
text-align: center;
}
#page_break .num li{
display: inline;
margin: 0 2px;
padding: 3px 5px;
border: 1px solid #ff7300;
background-color: #fff;

color: #ff7300;
text-align: center;
cursor: pointer;
font-family: arial;
font-size: 12px;
overflow: hidden;
}
#page_break .num li.on{
background-color: #ff7300;

color: #fff;
font-weight: bold;
}

 

分页效果

 

时间: 2024-07-29 03:24:10

jQuery+FCK编辑器+PHP实现文章分页代码的相关文章

net文章分页代码

   net文章分页代码,分页功能在任一个WEB开发项目中都会用到,所以今天我们就来看看net分页代码的实现方法  private PagedDataSource pds()     {         string connstring = ConfigurationManager.ConnectionStrings["Pubs"].ConnectionString;         //声明一个字符串,后面随时可以用         SqlConnection con = new

asp长文章分页代码

上段时间我写了一个php的长文章分页代码用到的explode来进行分割实现的,今天我们就来讲讲asp文章分页代码以及长文章分页和asp长文章分页方法.  Function c2u(myText) Dim i c2u = "" For i = 1 to Len(myText) c2u = c2u & "&#x" & Hex(AscW(Mid(myText, i, 1))) & ";" Next End Functio

PHP 文本文章分页代码 按标记或长度(不涉及数据库)_php实例

实例代码: 复制代码 代码如下: <?php /** * ********************************************************** * Read Me * 文章分页 * * 分页方式,可以按字数分页,按换行分页,按特殊标记分页等 * 其实实现思路是一样的,只是将其按一定规律放入一个数组 * 然后根据 url 传入的参数取得某个片段即可 * 大家完全可以写一个功能强大的函数保存起来以备不时之需 * * 题外话:很多编辑器都有插入分页按钮,利用插入的代码可

php 新闻文章分页代码实例教程

unction explode_content($content, $length) {  02 $i = 0;  03 $k = 1;  04 $j = 0;  05 $wn = 0;  06 $s = '';  07 $e = 1;  08 $yh = 0;  09 while ($k) {  10 $d = $content[$i];  11 if ($d !== '') {  12 if (ord($d) > 127) {  13 $j++;  14 $num = 2;  15 $i++

ASP实例代码:搞个长文章分页代码

以下为引用的内容: <%Class aspxsky_page Private Sub class_initialize End Sub  Public Function Alert(message,gourl)    message = replace(message,"'","\'")    If gourl="-1" then        Response.Write ("<script language=javasc

asp文章分页代码

'**************************************************** '函数名:StrLen '作  用:取得字符串长度(汉字为2) '参  数:str ----字符串内容 '返回值:字符串长度 '**************************************************** Function StrLen(Str)     Set rep = New regexp     rep.Global = True     rep.Ign

php fck文章分页

 php fck文章分页 fckeditor文章分页代码 <?php       $page =isset($_GET['page'])?$_GET['page']:1;//这里了得当前文章的分页编号如果没有就为1  $split ='<div style="page-break-after: always"><span style="display: none"> </span></div>'; //这里是fc

关于长文章分页的方法

问题描述 谁有插入分页符的文章分页代码 解决方案 解决方案二:string[]PageContent=Regex.Split(BookContent_Content,"~page~",RegexOptions.IgnoreCase);ltlContent.Text="<p>"+PageContent[page-1].ToString()+"</p>";解决方案三:有没有比较全点的代码解决方案四:这个和普通分页没什么区别的吧

asp.net使用FCK编辑器中的分页符实现长文章分页功能_实用技巧

本文实例讲述了asp.net使用FCK编辑器中的分页符实现长文章分页功能.分享给大家供大家参考,具体如下: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="SplitContent.aspx.cs" Inherits="SplitContent" %> <%@ Register Assembly="FredCK.FCKeditorV2&