午夜91福利视频,午夜成人在线观看,午夜在线视频免费观看,午夜福利短视频,精品午夜成人免费视频APP

幫助

pagelist列表分頁標簽實現數字分頁前后的省略號

2023-07-10 14:51 易優技巧

先上分頁示例圖


實現教程如下:

1、編輯列表模板,把分頁標簽pagelist加上一個標識pageno,dots,參考代碼

{eyou:pagelist listitem='pre,next,info,index,end,pageno,dots' listsize='1' /}


2、由(you)于每個模板分(fen)頁樣式不(bu)同,涉(she)及的分(fen)頁php文(wen)件官方不(bu)會在線更新覆蓋,請根據(ju)步驟(zou)找(zhao)到(dao)分(fen)頁php文(wen)件補充相關代碼。

    2.1、用編(bian)輯(ji)器(非記事本工具)打開文件 core/library/paginator/driver/Eyou.php  (注:Eyou.php為(wei)pc分頁文件,手機端的(de)為(wei):Mobile.php)

    2.2、在108行左右找到代碼  protected function getLinks($listsize = 3)  替換成  protected function getLinks($listsize = 3, $listitemArr = []) 

            

    2.3、把109行大(da)(da)括號(hao) { 開始(shi),到對應(ying)大(da)(da)括號(hao) } 結束的代碼(ma)進行替換

                /**

                *  頁碼按鈕(niu)

                * @param string $listsize  當前頁對稱兩邊(bian)的(de)條數(shu)

                * @return string

                */

                protected function getLinks($listsize  = 3, $listitemArr = [])

    ;            {

                            這里全部(bu)代碼都要被替換為(wei)2.4步驟的代碼

                }

            替換成以下代碼(ma):

    ;          /**

                *  頁碼按(an)鈕

                * @param string $listsize  當(dang)前頁(ye)對稱兩邊的條(tiao)數

                * @return string

 ;               */

              protected function getLinks($listsize = 3, $listitemArr = [])
        {
            if ($this->simple)
                return '';
    
            $block = [
                'first'  => null,
                'slider' => null,
                'last'   => null
            ];
    
            $side   = $listsize;
            $window = $side * 2;
    
            if ($this->lastPage < $window + 2) {
                $block['first'] = $this->getUrlRange(1, $this->lastPage);
            } elseif ($this->currentPage < ($side + 1)) {
                $block['first'] = $this->getUrlRange(1, $window + 1);
            } elseif ($this->currentPage > ($this->lastPage - $side)) {
                $block['last']  = $this->getUrlRange($this->lastPage - $window, $this->lastPage);
            } else {
                $block['slider'] = $this->getUrlRange($this->currentPage - $side, $this->currentPage + $side);
            }
    
            $html = '';
    
            if (is_array($block['first'])) {
                $html .= $this->getUrlLinks($block['first']);
                if (in_array('dots', $listitemArr)) {
                    if ($window + 1 < $this->lastPage) {
                        if ($window + 1 < $this->lastPage - 1) {
                            $html .= $this->getDots();
                        }
                        $html .= $this->getPageLinkWrapper2($this->url($this->lastPage), $this->lastPage);
                    }
                }
            }
    
            if (is_array($block['slider'])) {
                if (in_array('dots', $listitemArr)) {
                    if ($this->currentPage - $side > 1) {
                        $html .= $this->getPageLinkWrapper2($this->url(1), 1);
                        if ($this->currentPage - $side > 2) {
                            $html .= $this->getDots();
                        }
                    }
                }
    
                $html .= $this->getUrlLinks($block['slider']);
    
                if (in_array('dots', $listitemArr)) {
                    if ($this->currentPage + $side < $this->lastPage) {
                        if ($this->currentPage + $side < $this->lastPage - 1) {
                            $html .= $this->getDots();
                        }
                        $html .= $this->getPageLinkWrapper2($this->url($this->lastPage), $this->lastPage);
                    }
                }
            }
    
            if (is_array($block['last'])) {
                if (in_array('dots', $listitemArr)) {
                    if ($this->lastPage - $window < $this->lastPage) {
                        $html .= $this->getPageLinkWrapper2($this->url(1), 1);
                        if ($this->lastPage - $window > 2) {
                            $html .= $this->getDots();
                        }
                    }
                }
                $html .= $this->getUrlLinks($block['last']);
            }
    
            return $html;
        }


    2.4、看下圖找到這個代碼  array_push($pageArr, $this->getLinks($listsize));   替換成   array_push($pageArr, $this->getLinks($listsize, $listitemArr));

    


    完結。



工作日 8:30-12:00 14:30-18:00
周(zhou)六及部分節假日提供值班服務

易小優(you)
轉人工 ×