Content paging in Kindeditor parsing using php

Source: Internet
Author: User
The project requires that the content added in the editing can be paginated, so the default paging insert character in Kindeditor is changed to {page }}. The project development language is PHP. For example, the htmlt code of content is as follows {code ...} after using the explode separation of PHP, I found that the special string on the page... the project requires that the content added in the editing can be paginated, so the default paging insert character in Kindeditor is changed to {page }}. The project development language is PHP.

For example, the HTML code of content is as follows:

The first phase of the Hanlin family is about to be handed over, and the owners are full of expectations for their new home. At two o'clock P.M. on October 11, September 20, Hanlin xuanyuan will invite senior Interior Designers and home accessories masters to provide dedicated services for the owners of Hanlin Shijia sales department in the areas of personalized home experience and home culture, we hope to provide professional help for the house decoration of the owners.

2014 household fashion trend Decoding

Intelligent bathroom, brilliant synthetic materials, environmental protection, original ecological floors, natural coatings ...... A comfortable life can make people relax physically and mentally. Now, urban life makes people more comfortable, warm, and practical to their home environment, it is a kind of yearning for a better home life and a relentless pursuit of high-quality home quality. Like the cutting-edge fashion show in Paris, this year's home industry has also ushered in a new fashion trend: the trend of New Oriental that people prefer, the fashion is dazzling, or the original color, fresh and natural logs? Hanlin family invited famous artists to decode popular household passwords, bringing the popular elements of 2014 to the owners.

2014 Hanlin Shijia traffic center apartment design

Two-person world, full of romance, 90-party modern simple three-step home, luxurious and comfortable, high-end and elegant four generations of the same hall; Chinese style, Mediterranean style, European style, American style ...... In this session, the family of AI is designed by Han linshijia for the apartment that will be handed over. The elite designers will present the room in the form of a plan and a combination of real-time works, multiple Design Styles and solutions help you find a satisfactory decoration solution.

{Page }}

2014 Super Space Arrangement


Super space sorting, taking the initiative. The large drawers under the bed can be easily stored. books and records are placed on shelves on the walls, making the bedroom a rich space for entertainment and relaxation. The balcony becomes a flower room, which is environmentally friendly and beautiful ...... Designers are experts in space arrangement and planning technology, while senior design is well-developed. In the home decoration class of Hanlin xuanyuan, Senior designers plan the residential space of the owners of Hanlin Shijia and design the magic space.

After using PHP's explode separation, I found that the special string on the page is marked with html, which causes html to lack the specified end symbol or start symbol.

I am only a little bit familiar with regular expressions. Which of the following can help me with a solution? Or it is better to match the {page} current and several pieces of html tags.

Reply content:

The project requires that the content added in the editing can be paginated, so the default paging insert character in Kindeditor is changed to {page }}. The project development language is PHP.

For example, the HTML code of content is as follows:

The first phase of the Hanlin family is about to be handed over, and the owners are full of expectations for their new home. At two o'clock P.M. on October 11, September 20, Hanlin xuanyuan will invite senior Interior Designers and home accessories masters to provide dedicated services for the owners of Hanlin Shijia sales department in the areas of personalized home experience and home culture, we hope to provide professional help for the house decoration of the owners.

2014 household fashion trend Decoding

Intelligent bathroom, brilliant synthetic materials, environmental protection, original ecological floors, natural coatings ...... A comfortable life can make people relax physically and mentally. Now, urban life makes people more comfortable, warm, and practical to their home environment, it is a kind of yearning for a better home life and a relentless pursuit of high-quality home quality. Like the cutting-edge fashion show in Paris, this year's home industry has also ushered in a new fashion trend: the trend of New Oriental that people prefer, the fashion is dazzling, or the original color, fresh and natural logs? Hanlin family invited famous artists to decode popular household passwords, bringing the popular elements of 2014 to the owners.

2014 Hanlin Shijia traffic center apartment design

Two-person world, full of romance, 90-party modern simple three-step home, luxurious and comfortable, high-end and elegant four generations of the same hall; Chinese style, Mediterranean style, European style, American style ...... In this session, the family of AI is designed by Han linshijia for the apartment that will be handed over. The elite designers will present the room in the form of a plan and a combination of real-time works, multiple Design Styles and solutions help you find a satisfactory decoration solution.

{Page }}

2014 Super Space Arrangement


Super space sorting, taking the initiative. The large drawers under the bed can be easily stored. books and records are placed on shelves on the walls, making the bedroom a rich space for entertainment and relaxation. The balcony becomes a flower room, which is environmentally friendly and beautiful ...... Designers are experts in space arrangement and planning technology, while senior design is well-developed. In the home decoration class of Hanlin xuanyuan, Senior designers plan the residential space of the owners of Hanlin Shijia and design the magic space.

After using PHP's explode separation, I found that the special string on the page is marked with html, which causes html to lack the specified end symbol or start symbol.

I am only a little bit familiar with regular expressions. Which of the following can help me with a solution? Or it is better to match the {page} current and several pieces of html tags.

Here is an automatically completed php code:

/*** close all open xhtml tags at the end of the string* @param string $html* @return string* @author Milian Wolff*/function closetags($html) {    #put all opened tags into an array    preg_match_all('#<([a-z]+)(?: .*)?(?
  #iU', $html, $result);    $openedtags = $result[1];    #put all closed tags into an array    preg_match_all('#
  #iU', $html, $result);    $closedtags = $result[1];    $len_opened = count($openedtags);    # all tags are closed    if (count($closedtags) == $len_opened) {    return $html;    }    $openedtags = array_reverse($openedtags);    # close tags    for ($i=0; $i < $len_opened; $i++) {    if (!in_array($openedtags[$i], $closedtags)){    $html .= '
  ';    } else {    unset($closedtags[array_search($openedtags[$i], $closedtags)]);    }    }    return $html;}

This function can be used to complete html tags that are not closed, so as to avoid display problems ~

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.