易优模板列表分页标签pagelist数字分页前后省略号的实现方法

资源来源网络,如需授权,请更换源码,模块仅供学习,如需商用请购买正版授权,本栏目不提供技术服务,积分不够请签到!如何签到?系统升级暂停签到,恢复关注公告!
如遇下载链接蓝奏网盘打不开lanzous替换成lanzoux尝试! 广告

1、编辑列表模板,把分页标签pagelist加上一个标识pageno,dots,参考代码

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

2、由于每个模板分页样式不同,涉及的分页php文件官方不会在线更新覆盖,请根据步骤找到分页php文件补充相关代码。

2.1、用编辑器(非记事本工具)打开文件 core/library/paginator/driver/Eyou.php

2.2、在108行左右找到代码 protected function getLinks($listsize = 3) 替换成 protected function getLinks($listsize = 3, $listitemArr = [])
2.3、把109行大括号 { 开始,到对应大括号 } 结束的代码进行替换

/**
* 页码按钮
* @param string $listsize 当前页对称两边的条数
* @return string
*/
protected function getLinks($listsize = 3, $listitemArr = [])
{
这里全部代码都要被替换为2.4步骤的代码
}

替换成以下代码:

/**
* 页码按钮
* @param string $listsize 当前页对称两边的条数
* @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));

©下载资源版权归作者所有;本站所有资源均来源于网络,仅供学习使用,请支持正版!
风格酷模板网 » 易优模板列表分页标签pagelist数字分页前后省略号的实现方法
NOTICE:【咨询风格酷】客服QQ:1131734965
NOTICE:【咨询风格酷】客服微信:wwwxmamnet
NOTICE:【风格酷模板网②群】QQ群:288678775
☉免责声明:本站所有模板均来自用户分享和网络收集,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服,我们核实后会立即删除。
☉如果源码网盘地址失效!或有其他问题,请点我报错,谢谢合作!
☉人民币与积分汇率为1比10,即1元=10积分.有任何疑问请联系客服
☉如有其他问题,请加网站客服QQ(1131734965)进行交流。
☉本站提供的源码、模板、软件工具等其他资源,都不包含技术服务,请大家谅解!
☉源码、模板等资源会随着技术、环境的升级而存在部分问题,还请慎重选择。

发表评论

风格酷模板网www.xmam.net分享优质网站模板

立即查看 了解详情