更新:自定义分页支持自定义输出分页按钮个数
parent
63f1189779
commit
722992e615
|
@ -85,9 +85,12 @@ class CustomPageHelper extends Paginator
|
||||||
return $this->getPageLinkWrapper($url, $text);
|
return $this->getPageLinkWrapper($url, $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 渲染分页
|
// 渲染分页 $btnNumber [0 只显示上下页 | >= 3]
|
||||||
public function render($type = '')
|
public function render($btnNumber = 10, $type = '')
|
||||||
{
|
{
|
||||||
|
if($btnNumber == 0 || $btnNumber >= 3) {
|
||||||
|
$this->btnNumber = $btnNumber;
|
||||||
|
}
|
||||||
//数据是否足够分页
|
//数据是否足够分页
|
||||||
if ($this->hasPages()) {
|
if ($this->hasPages()) {
|
||||||
if(strtoupper($type) == 'A') {
|
if(strtoupper($type) == 'A') {
|
||||||
|
@ -154,7 +157,7 @@ class CustomPageHelper extends Paginator
|
||||||
foreach ($urls as $page => $url) {
|
foreach ($urls as $page => $url) {
|
||||||
$html .= $this->getPageLinkWrapper($url, $page, $htmlClass);
|
$html .= $this->getPageLinkWrapper($url, $page, $htmlClass);
|
||||||
}
|
}
|
||||||
if($ellipsis) {
|
if($ellipsis && $this->btnNumber > 0) {
|
||||||
$html .= $this->getDisabledTextWrapper('...', $htmlClass);
|
$html .= $this->getDisabledTextWrapper('...', $htmlClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue