phpcms分页错误怎么解决?
PHPCMS分页出错的解决办法
打开/include/global.func.php查找函数function pages($total, $page = 1, $perpage = 20, $urlrule = '', $array = array(), $catid = 0) 可以看到pages函数结构如下 代码: function pages(){ ..... if(){ ..... } else{ ..... } ..... } 把else内的内容即:
代码:
else { $firstpage = pageurl($urlrule, 1, $array); $prepage = pageurl($urlrule, $prepage, $array); $nextpage = pageurl($urlrule, $nextpage, $array); $lastpage = pageurl($urlrule, $pages, $array); $urlpre = pageurl($urlrule, '', $array); }
替换为
代码:
else { /*修改分页------------------------------------开始*/ /* $firstpage = pageurl($urlrule, 1, $array); $prepage = pageurl($urlrule, $prepage, $array); $nextpage = pageurl($urlrule, $nextpage, $array); $lastpage = pageurl($urlrule, $pages, $array); $urlpre = pageurl($urlrule, '', $array); */
if (( strpos(urldecode($urlrule),'mod=phpcms&file=content') > 0 and strpos(urldecode($urlrule),'mod=phpcms&file=content&action=manage') <= 0 and strpos(urldecode($urlrule),'mod=phpcms&file=content_all') <= 0 and strpos(urldecode($urlrule),'mod=phpcms&file=block') <= 0) or strpos(urldecode($urlrule),'mod=phpcms&file=html') > 0){ global $catid; $url = load('url.class.php'); $firstpage = $url->category($catid, 1, 1); $prepage = $url->category($catid, $prepage, 1); $nextpage = $url->category($catid, $nextpage, 1); $lastpage = $url->category($catid, $pages, 1); $urlpre = $url->category($catid, '', 1); } else { $firstpage = pageurl($urlrule, 1, $array); $prepage = pageurl($urlrule, $prepage, $array); $nextpage = pageurl($urlrule, $nextpage, $array); $lastpage = pageurl($urlrule, $pages, $array); $urlpre = pageurl($urlrule, '', $array); } /*修改分页------------------------------------结束*/ } 最后的pages如下 代码: function pages($total, $page = 1, $perpage = 20, $urlrule = '', $array = array(), $catid = 0) { global $PHPCMS; if($total < 1) return ''; if($urlrule == '') $urlrule = url_par('page={$page}'); $pages = ceil($total/$perpage); $page = min($pages, $page); $prepage = $page - 1; $prepage = max($prepage, 1); $nextpage = $page+1; $nextpage = min($nextpage, $pages); if($catid) { $url = load('url.class.php'); $firstpage = $url->category($catid, 1, 1); $prepage = $url->category($catid, $prepage, 1); $nextpage = $url->category($catid, $nextpage, 1); $lastpage = $url->category($catid, $pages, 1); $urlpre = $url->category($catid, '', 1); } else { /*修改分页------------------------------------开始*/ /* $firstpage = pageurl($urlrule, 1, $array); $prepage = pageurl($urlrule, $prepage, $array); $nextpage = pageurl($urlrule, $nextpage, $array); $lastpage = pageurl($urlrule, $pages, $array); $urlpre = pageurl($urlrule, '', $array); */ if (( strpos(urldecode($urlrule),'mod=phpcms&file=content') > 0 and strpos(urldecode($urlrule),'mod=phpcms&file=content&action=manage') <= 0 and strpos(urldecode($urlrule),'mod=phpcms&file=content_all') <= 0 and strpos(urldecode($urlrule),'mod=phpcms&file=block') <= 0) or strpos(urldecode($urlrule),'mod=phpcms&file=html') > 0){ global $catid; $url = load('url.class.php'); $firstpage = $url->category($catid, 1, 1); $prepage = $url->category($catid, $prepage, 1); $nextpage = $url->category($catid, $nextpage, 1); $lastpage = $url->category($catid, $pages, 1); $urlpre = $url->category($catid, '', 1); } else { $firstpage = pageurl($urlrule, 1, $array); $prepage = pageurl($urlrule, $prepage, $array); $nextpage = pageurl($urlrule, $nextpage, $array); $lastpage = pageurl($urlrule, $pages, $array); $urlpre = pageurl($urlrule, '', $array); } /*修改分页------------------------------------结束*/ } $data = str_replace('"', '/"', $PHPCMS['pageshtml']); eval("/$url = /"$data/";"); return $url; }
,大量的免费PHPCMS教程,欢迎在线学习!
1、本文来自 iHu 投稿的内容 解决PHPCMS分页错误:快速修复方法与技巧 ,所有言论和图片纯属作者个人意见,版权归原作者所有;不代表 本站 立场;
2、本站所有文章、图片、资源等如果未标明原创,均为收集自互联网公开资源;分享的图片、资源、视频等,出镜模特均为成年女性正常写真内容,版权归原作者所有,仅作为个人学习、研究以及欣赏!如有涉及下载请24小时内删除;
3、如果您发现本站上有侵犯您的权益的作品,请与我们取得联系,我们会及时修改、删除并致以最深的歉意。邮箱: i-hu#(#换@)foxmail.com
2、本站所有文章、图片、资源等如果未标明原创,均为收集自互联网公开资源;分享的图片、资源、视频等,出镜模特均为成年女性正常写真内容,版权归原作者所有,仅作为个人学习、研究以及欣赏!如有涉及下载请24小时内删除;
3、如果您发现本站上有侵犯您的权益的作品,请与我们取得联系,我们会及时修改、删除并致以最深的歉意。邮箱: i-hu#(#换@)foxmail.com