Home > php教程 > php手册 > FCKEditor+jQuery+PHP实现分页

FCKEditor+jQuery+PHP实现分页

WBOY
Release: 2016-06-13 11:36:54
Original
995 people have browsed it

一、插入新闻

FCKEditor是一款很流行的即插即用WEB编辑器,它支持ASP、PHP、Java等语言。这里要介绍的是利用编辑器的“插入分页符”功能,实现页面的无刷新分页。

编辑新闻时,在需要插入分页的段落处插入分页符,保存即可。

二、读取新闻

在读取新闻字段时,通过PHP分页函数对新闻字段数据进行处理,代码如下:

PHP代码
function pageBreak($content)
{
$content = $content;
$pattern = "/

 /";
$strSplit = preg_split($pattern, $content, -1, PREG_SPLIT_NO_EMPTY);
$count = count($strSplit);
$outStr = "";
$i = 1;

if ($count > 1 ) {
$outStr = "

";
foreach($strSplit as $value) {
if ($i $outStr .= "
$value
";
} else {
$outStr .= "
$value
";
}
$i++;
}

$outStr .= "

";
for ($i = 1; $i $outStr .= "
  • $i
  • ";
    }
    $outStr .= "
    ";
    return $outStr;
    } else {
    return $content;
    }
    }
    • 共2页:
    • 上一页
    • 1
    • 2
    • 下一页
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template