virtual
15008401624 2020-12-09 09:29:53 +08:00
commit 683242cb2b
2 changed files with 16 additions and 7 deletions

View File

@ -85,9 +85,12 @@ class CustomPageHelper extends Paginator
return $this->getPageLinkWrapper($url, $text);
}
// 渲染分页
public function render($type = '')
// 渲染分页 $btnNumber [0 只显示上下页 | >= 3]
public function render($btnNumber = 10, $type = '')
{
if($btnNumber == 0 || $btnNumber >= 3) {
$this->btnNumber = $btnNumber;
}
//数据是否足够分页
if ($this->hasPages()) {
if(strtoupper($type) == 'A') {
@ -154,7 +157,7 @@ class CustomPageHelper extends Paginator
foreach ($urls as $page => $url) {
$html .= $this->getPageLinkWrapper($url, $page, $htmlClass);
}
if($ellipsis) {
if($ellipsis && $this->btnNumber > 0) {
$html .= $this->getDisabledTextWrapper('...', $htmlClass);
}

View File

@ -17,17 +17,23 @@ function getMenus($menus, $level = 1, $currentFirstId, $categoryId) {
}
$aHref = getUri($menu);
$aHref = empty($aHref) ? 'javascript:;' : $aHref;
$spanClass = '';
$hasChild = false;
if (isset($menu['children']) && count($menu['children']) > 0) {
$hasChild = true;
$spanClass = 'class="cur"';
}
if($level == 1) {
$menuHtml .= '<li class="'.$activeClass.'" >';
$menuHtml .= '<span><a href="'.$aHref.'" target="'.$menu['style'].'">'.$menu['title'].'</a></span>';
if (isset($menu['children']) && count($menu['children']) > 0) {
$menuHtml .= '<span '.$spanClass.'><a href="'.$aHref.'" target="'.$menu['style'].'">'.$menu['title'].'</a></span>';
if ($hasChild) {
$menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId);
}
$menuHtml .= '</li>';
} else {
$menuHtml .= '<a href="'.$aHref.'" target="'.$menu['style'].'" class="'.$activeClass.'">';
$menuHtml .= '<span>'.$menu['title'].'</span>';
if (isset($menu['children']) && count($menu['children']) > 0) {
$menuHtml .= '<span '.$spanClass.'>'.$menu['title'].'</span>';
if ($hasChild) {
$menuHtml .= getMenus($menu['children'], $level + 1, $currentFirstId, $categoryId);
}
$menuHtml .= '</a>';