Home > Backend Development > PHP Tutorial > FCKEditor+jQuery+PHP implements paging_PHP tutorial

FCKEditor+jQuery+PHP implements paging_PHP tutorial

WBOY
Release: 2016-07-21 14:54:21
Original
973 people have browsed it

1. Insert news

FCKEditor is a very popular plug-and-play WEB editor that supports ASP, PHP, Java and other languages. What I want to introduce here is to use the "insert page break" function of the editor to realize page refresh-free paging.

When editing news, insert page breaks at the paragraphs where page breaks are needed and save.

2. Read news

When reading the news field, the news field data is processed through the PHP paging function. The code is as follows:

PHP code
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 <= 1) {
$outStr .= "
$value
";
} else {
$outStr .= "< div id='page_$i' class='collapse'>$value
";
}
$i++;
}

$outStr .= "

";
for ($i = 1; $i <= $count; $i++) {
$outStr .= "
  • $i
  • ";
    }
    $outStr .= "
    ";
    return $outStr;
    } else {
    return $content;
    }
    }

    • Total 2 pages:
    • Previous page
    • 1
    • 2
    • Next page

    www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364645.htmlTechArticle1. Insert news FCKEditor is a very popular plug-and-play WEB editor that supports ASP and PHP , Java and other languages. What I want to introduce here is to use the editor's insert page break function to realize page...
    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