PHP kindeditor article page-by-instance method _php Tutorial

Source: Internet
Author: User
We introduce how PHP and Kindeditor editor use the Kindeditor Editor's paging function to implement the article content paging, Kindeditor editor will be inserted when we click on pagination Code, we just use it as a separator, it is possible, the specific paging method is as follows.

My understanding of the core code

code as follows copy code

$news = Array (
' title ' = ' First ',
' content ' = '

This is paragraph 1

'
. '

This is paragraph 2

'
. ' Now I make a page end. [--page--] Page 2 start~~~~~ '
);

$newsModel->insert ($news);
=================================

//news_detail.php?p=2:

$news _one = $newsModel->get (1);

$content _pages = explode (' [--page--] ', $news _one[' content ');

$cur _page = min (max (1,intval ($_get[' P ')), COUNT ($content _pages));

$news _one[' content '] = $content _pages[$cur _page-1];

Return render (' news_detail.html ', $news _one);

We know that in many online editors there is the ability to insert pagination, like clicking Insert Page Editor in Kindeditor to insert the following code where the cursor is:

The code is as follows Copy Code

The ueditor will be added at the cursor:

_ueditor_page _break_tag__ueditor_page and _break_tag_ There is no space between, because this site is also used by the Ueditor use of the page break is Break_tag, so the above added a space to avoid the impact of

Here I take kindeditor as an example, paste my code:

The code is as follows Copy Code





Document


$content =<<<>

Shanghai top wants Information Technology Co., Ltd. (Topthink Inc.) is a leading web application and service provider dedicated to the development and service of Web application platforms, products and applications, providing web-based application development solutions and products for enterprises. Founded in September 2008, is a company with independent intellectual property rights of high-tech enterprises.



Long-term focus on the Web application framework, application platform and enterprise Solutions Research, the company's core technical framework thinkphp by the founder of Liu Chen in 2006, after more than 6 years of careful build and development, with a broad user base and a good reputation in the industry, has grown into the domestic leading and most influential Web application development framework, foreign countries have a considerable advantage over the year. Its application areas in various industries, in the portal, community and e-commerce has a very good support and expansion, the size of thousands of cases, in security, efficiency, load has a great advantage, has become a rapid development of Web applications solutions and best practices!




Headquartered in Shanghai, the company has a team of professional planners, design and technical teams as well as a wide range of community-based technologies, leading the 10-year-old expert in Internet and user experience research. The company has long been relying on the industry's influence, good customers and cooperative relations, invited a number of security and project experts as a consultant, strong to ensure the development and implementation of customer projects. The company also has a senior user experience and Design research team, tailored to different users of user experience process, has a good product design and design concepts.
2009 was recommended for the selection of major literary and artistic creation projects in Shanghai.


Str

$content = Preg_replace ("' iUs", "", $content);
$content = Explode ("", $content);
$count = count ($content);
$p = Empty ($_get[' page ')? 1: (int) $_get[page];
$p = $p = = 0? 1: $p;
$p = $p > $count? $count: $p;
$p--;
$content = $content [$p];
$p + +;
if ($count > 1) {
$page = ' home ';
for ($i = 1; $i <= $count; $i + +) {
$page. = $i = = $p? '【' . $i. '】' : '【' . $i. '】';
}
$page. = ' last ';

}
echo "

Shanghai Top wanted Information Technology Co., Ltd.

";
Echo $content;

echo "{$page}";

?>

According to the above code you can implement the article pagination, the effect such as:

If you are using the Ueditor editor page break by default: _ueditor_page _break_tag_ (You can modify the Pagebreaktag settings in ueditor.config.js) You can modify the above code slightly:

The code is as follows Copy Code

$content = Preg_replace ("' iUs", "", $content);
$content = Explode ("", $content);

Switch

$content = Explode ("_ueditor_page _break_tag_", $content);

So you can, of course, customize any page breaks.

http://www.bkjia.com/PHPjc/632801.html www.bkjia.com true http://www.bkjia.com/PHPjc/632801.html techarticle we are here to introduce how PHP and Kindeditor editor use the Kindeditor Editor's paging function to implement the article content paging, Kindeditor editor when we click on the page to insert code ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.