Thinkphp and Bootstrap work together to create personalized paging styles (recommended), thinkphpbootstrap
First, let's talk about the page style of ThinkPHP3.1. Although it looks simple and generous, all the page numbers are simple numbers. The gap between them is small and easy to understand, the "first five pages" and "last five pages" appear redundant, because clicking the "Previous Page" button on the first page shows the first five pages.
The paging Effect of 3.1 is as follows:
The alias file. After using the paging function in the Controller, the foreground will naturally display it in the BootStrap style. The effect is as follows:
However, ThinkPHP5 was not available when I developed the top search network and used version 3.1. How can I use the BootStrap paging component in version 3.1? The solution is as follows:
1. native page. class. php class derived from thinkphp
In order not to affect the core file (in violation of the design pattern type modification and sealing principle), I derived a subclass ListPage. The subclass code is as follows:
Import ('org. util. page '); // import the pagination class ListPage extends Page {// rewrite the related functions in the Page class for the User controller features of the system/*** display the output by Page * @ access public */protected $ config = array ('header' => 'record ', 'prev' => '<', 'Next' => ', 'First' => '<', 'last' => ', 'Theme '=>' % first % upPage % linkPage % downPage % end % ');......
As you can see, first import the file where the core class is located, and then you can boldly derive it. Here, only the core code is listed. We only need to modify the Config variable in the page class. In the subclass, rewrite the variable as the above form, and then all the actions (Controller) to create a paging object:
$Page=new ListPage($count,5);
In this way, we can use the settings above. Well, the new page display effect is as follows:
The above section describes Thinkphp and Bootstrap used in combination to create personalized paging styles (recommended). I hope this will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!