1 file found :/thinkphp/library/think/paginator/driver/Bootstrap.php

<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2017 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: zhangyajun <448901948@qq.com>
// +---------------------------------------------------------------------- namespace think\paginator\driver; use think\Paginator; class Bootstrap extends Paginator
{ /*
* Previous button
* @param string $text
* @return string
*/
protected function getPreviousButton($text = " The previous page ")
{ if ($this->currentPage() <= 1) {
return $this->getDisabledTextWrapper($text);
} $url = $this->url(
$this->currentPage() - 1
); return $this->getPageLinkWrapper($url, $text);
} /**
* Next button
* @param string $text
* @return string
*/
protected function getNextButton($text = ' The next page ')
{
if (!$this->hasMore) {
return $this->getDisabledTextWrapper($text);
} $url = $this->url($this->currentPage() + 1); return $this->getPageLinkWrapper($url, $text);
} /**
* Home button
* @param string $text
* @return string
*/
protected function getFirstButton($text = ' home page ')
{
$nowPage = $this->rollPage;// Calculate paging temporary variables
// When When the total number of pages is greater than the defined number of pages And When the current page number is larger than the previous pages Show home page
if ($this->lastPage > $this->showPage && $this->currentPage > $nowPage) { $url = $this->url(1); return $this->getPageLinkWrapper($url, $text);
}
} /**
* Last button
* @param string $text
* @return string
*/
protected function getLastButton($text = ' Last ')
{
$nowPage = $this->rollPage;// Calculate paging temporary variables // When When the total number of pages is greater than the defined number of pages And When the current number of pages is less than the last few pages Show last page
if ($this->lastPage > $this->showPage && $this->currentPage < ($this->lastPage - $nowPage)) { $url = $this->url($this->lastPage); return $this->getPageLinkWrapper($url, $text);
}
} /**
* Page buttons
* @return string
*/
protected function getLinks()
{
if ($this->simple)
return ''; $block = [
'first' => null,
'slider' => null,
'last' => null
]; $side = 3;
$window = $side * 2; if ($this->lastPage < $window + 6) {
$block['first'] = $this->getUrlRange(1, $this->lastPage);
} elseif ($this->currentPage <= $window) {
$block['first'] = $this->getUrlRange(1, $window + 2);
$block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage);
} elseif ($this->currentPage > ($this->lastPage - $window)) {
$block['first'] = $this->getUrlRange(1, 2);
$block['last'] = $this->getUrlRange($this->lastPage - ($window + 2), $this->lastPage);
} else {
$block['first'] = $this->getUrlRange(1, 2);
$block['slider'] = $this->getUrlRange($this->currentPage - $side, $this->currentPage + $side);
$block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage);
} $html = ''; if (is_array($block['first'])) {
$html .= $this->getUrlLinks($block['first']);
} if (is_array($block['slider'])) {
$html .= $this->getDots();
$html .= $this->getUrlLinks($block['slider']);
} if (is_array($block['last'])) {
$html .= $this->getDots();
$html .= $this->getUrlLinks($block['last']);
} return $html;
} /**
* Render paging html
* @return mixed
*/
public function render()
{
if ($this->hasPages()) {
if ($this->simple) {
return sprintf(
'<ul class="pager">%s %s</ul>',
$this->getPreviousButton(),
$this->getNextButton()
);
} else {
return sprintf(
'<ul class="pagination">%s %s %s</ul>',
$this->getPreviousButton(),
$this->getLinks(),
$this->getNextButton()
);
}
}
} /**
* Generate a clickable button
*
* @param string $url
* @param int $page
* @return string
*/
protected function getAvailablePageWrapper($url, $page)
{
return '<li><a href="' . htmlentities($url) . '">' . $page . '</a></li>';
} /**
* Generate a disabled button
*
* @param string $text
* @return string
*/
protected function getDisabledTextWrapper($text)
{
return '<li class="disabled"><span>' . $text . '</span></li>';
} /**
* Generate an active button
*
* @param string $text
* @return string
*/
protected function getActivePageWrapper($text)
{
return '<li class="active"><span>' . $text . '</span></li>';
} /**
* Generate ellipsis button
*
* @return string
*/
protected function getDots()
{
return $this->getDisabledTextWrapper('...');
} /**
* Batch generate page number button .
*
* @param array $urls
* @return string
*/
protected function getUrlLinks(array $urls)
{
$html = ''; foreach ($urls as $page => $url) {
$html .= $this->getPageLinkWrapper($url, $page);
} return $html;
} /**
* Generate normal page number button
*
* @param string $url
* @param int $page
* @return string
*/
protected function getPageLinkWrapper($url, $page)
{
if ($page == $this->currentPage()) {
return $this->getActivePageWrapper($page);
} return $this->getAvailablePageWrapper($url, $page);
}
}

2 Add the style

<style>
/* Page style */
.pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
.pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
.pagination .active{background-color: #46A3FF;color: #fff;}
.pagination .disabled{color:#aaa;}
</style>

【thinkphp5】 More related articles on pagination style modification

  1. The empire cms Modify and beautify the paging style of list page 【2】

    Last one ( The empire cms Modify and beautify the paging style of list page [1]) We've given a general idea of pagination in , Now let's make a paging handle by ourselves : First step : Enter the Empire cms backstage , Click system settings -> system parameter setting -> Information settings : Inside ...

  2. The empire cms Modify and beautify the paging style of list page 【1】

    [1] Modify the Empire yourself cms Default pagination style (css), The advantage of this is that you don't have to change the core files of the Empire , Easy to upgrade later . [2] Do it yourself to modify the pagination of the Empire (php+css), The pages of the Empire are e>class> Next ...

  3. The empire cms Page styles modify files - matters needing attention

    The empire cms Pagination styles mainly include : Content page pagination style . List page pagination style and the search style used by the default search template . It's very easy to change these styles , Find the corresponding... In the website directory .css File modification empages Property is fine , But it's more numb ...

  4. change ligerui Source code to achieve pagination style modification

    The modified style : First step : Realization function . Change the source code section ligerui.all.js file Read the source code , Find out ligerui The bottom toolbar is implemented like this (ps: The annotation part is the source code ) _render: function () { ...

  5. thinkphp5.1 Use in Bootstrap4 Pagination style modification

    1. find thinkphp Under the Boorstrap Source code \thinkphp\library\think\paginator\driver\Bootstrap.php 2 Modify the source code directly <?php ...

  6. ThinkPHP5 Paging style settings

    In the manual, when it comes to the use of paging classes, the style is not detailed enough , Here I'll give you some suggestions based on my personal exploration . config In the paging configuration, I use the system default bootstrap, see thinkphp\library\think\p ...

  7. modify DeDe label Pagelist Page style

    We were using the dede When I'm standing in imitation , When paging the article list page , We will use : {dede:pagelist listitem=”info,index,end,pre,next,pageno” listsize=” ...

  8. modify DeDe label Pagelist Page style , Custom pagination style

    We were using the dede When I'm standing in imitation , When paging the article list page , We will use : {dede:pagelist listitem="info,index,end,pre,next,pageno" ...

  9. ThinkPHP5 Custom pagination style

    1. stay thinkphp/library/think/paginator/driver New file in directory Page.php Pay attention to the namespace and inheritance <?php namespace think\paginat ...

Random recommendation

  1. Linux Platform development guide

    Statement : The following is excerpted from http://www.me115.com/post/25.html The following technologies and tools are Linux The foundation of working under the platform , Have a good command of : C++ Working language , The importance is self-evident : introduction : <C++ ...

  2. Atitit Deepen understanding UUID Meaning is the universal unique identification code (Universally Unique Identifier),

    Atitit Deepen understanding UUID Meaning is the universal unique identification code (Universally Unique Identifier), UUID1 effect 1 form 1 Globally unique identifier (GUID)2 UUID edit UUID ...

  3. jQuery Ajax Traversal table , Fill in the data , Put the data in the table one by one Jason Array

    $.ajax({ url: baseURL + "InvoiceSale/OnQuotaInvoiceSale", // When you click the write off number , When you click write off , Interactive pages           ...

  4. 【7 Set iCore3 Basic video 】7-5 iTool2 Drive installation

    iTool2 Drive installation : Gao Qingyuan video : link :http://pan.baidu.com/s/1dF5FtlB%20 password :g5x7 iCore3 Buy links :https://item.taobao.com/i ...

  5. ASP.NET The problem of uploading large files

    original text :http://www.cnblogs.com/wolf-sun/p/3657241.html?utm_source=tuicool&utm_medium=referral introduction Before using ...

  6. Git Study --&gt; Personal common commands add,commit as well as push

    Git Command line configuration 1 install Github2 install msysgit3 To configure the user name and fuel tank   git config --global user.name < user name >  My order is :git confi ...

  7. Spring Of qualifier label

    @Autowired It is automatically assembled according to the type . If so Spring More than one in context UserDao Type of bean when , Will throw BeanCreationException abnormal ; If Spring There is no... In the context ...

  8. PB Tips

    1. The data window checks for duplicate rows dw_1.SetSort ("user_id A")dw_1.Sort()dw_1.SetFilter ("user_id = user_id[- ...

  9. asp.net Download function in

    // Download by streaming protected void ButtonButtonDownload_Click(object sender, EventArgs e) { //string fileName = ...

  10. 《University Calculus》-chaper12- Multivariate function - Lagrange multiplier method

    The method of solving conditional extremum : Lagrange multiplier method Based on the understanding of the extremum method of multivariate function , Among the specific problems, we find such a problem , In solving f(x,y,z) At the extreme value of , We need the extreme point to fall on g(x,y,z) On the other hand, there are some constraints on the extremum , through ...