Rumah  >  Artikel  >  Tutorial CMS  >  phpcms分页错误怎么解决

phpcms分页错误怎么解决

藏色散人
藏色散人asal
2020-02-05 10:29:402925semak imbas

phpcms分页错误怎么解决

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, &#39;&#39;, $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, &#39;&#39;, $array); } /*修改分页------------------------------------结束*/ } $data = str_replace('"', '/"', $PHPCMS['pageshtml']); eval("/$url = /"$data/";"); return $url; }

PHP中文网,大量的免费PHPCMS教程,欢迎在线学习!

Atas ialah kandungan terperinci phpcms分页错误怎么解决. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn