This article mainly introduces Thinkphp and Bootstrap in combination to create personalized paging styles (recommended). It is very good and has reference value, you can refer to the paging style of ThinkPHP3.1. although it looks very simple and generous, all the page numbers are simple numbers with relatively small gaps, the "first five pages" and "last five pages" appear redundant because clicking the "previous page" 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. I would like to thank you for your support for the script home website!