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; }
PHP中文網,大量的免費PHPCMS教學,歡迎線上學習!
以上是phpcms分頁錯誤怎麼解決的詳細內容。更多資訊請關注PHP中文網其他相關文章!