The THINKPHP content is shared by page code and thinkphp by page. THINKPHP content page-by-page code sharing. thinkphp page-by-page sharing is used in the content management system developed by Thinkphp. many THINKPHP content must be developed by yourself. the THINKPHP content page-by-page code sharing must also be developed by yourself, thinkphp paging sharing
In the content management system developed using Thinkphp, many things need to be developed by myself, and the content paging should also be developed by myself. The following is my method based on the query information:
1. the first step is to insert a paging character when editing the content in the background. different editor paging characters are naturally different.
2. when reading the content of an article, you need to split the content into multiple arrays based on the pagination character. here, you need to pass the value on the current page, reads the split array based on the number of pages
The code is as follows:
The code is as follows:
$ Arr_con = explode ('_ ueditor_page_break_tag _', $ dy ['Art _ content']); // split the content
$ Pagenum = count ($ arr_con); // calculate the number of pages
// Determine the number of currently displayed pages based on the pass value
If (intval ($ _ GET ['P']) = 0 ){
$ P = 1;
} Else {
$ P = intval ($ _ GET ['P']);
}
// Obtain the url of the current page
$ Url = $ _ SERVER ['request _ URI ']. (strpos ($ _ SERVER ['request _ URI'], '? ')? '':"? ");
$ Parse = parse_url ($ url );
If (isset ($ parse ['query']) {
Parse_str ($ parse ['query'], $ params );
Unset ($ params ['P']);
$ Url = $ parse ['path']. '? '. Http_build_query ($ params );
}
// How many pages are all cyclically displayed
For ($ I = 1; $ I <= $ pagenum; $ I ++ ){
If ($ I = $ p ){
$ Show. = '['. $ I. ']';
}
Else {
$ Show. = '['. $ I. ']';
}
}
// Dump ($ arr_con );
$ Show = $ pagenum = 1? '': $ Show; // paging code display judgment
{$ Arr_con [$ P-1]}
Note: If Thinkphp is used and static is configured,
Modify the configuration file 'news: article' => array ('{: module}/{: action }_{ art_id }_{ p}', 0), and add a p parameter.
The above is for reference only, but we also need to adjust it based on our specific projects. I believe our partners can extend it well.
In the content management system developed using Thinkphp, ghost needs to develop many things by itself, and content paging needs to be developed by itself...