首頁  >  文章  >  CMS教程  >  phpcms分頁錯誤怎麼解決

phpcms分頁錯誤怎麼解決

藏色散人
藏色散人原創
2020-02-05 10:29:402925瀏覽

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教學,歡迎線上學習!

以上是phpcms分頁錯誤怎麼解決的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn