想修改PHPCMS分页的URL 有好人吗?
- PHP code
function pages($num, $curr_page, $perpage = 20, $urlrule = '', $array = array(), $catid = 0) { global $PHPCMS; if($PHPCMS['pagemode'] && $num > $perpage) { $url = load('url.class.php'); $multipage = ''; if($num > $perpage) { $page = 11; $offset = 4; $pages = ceil($num / $perpage); $from = $curr_page - $offset; $to = $curr_page + $offset; $more = 0; if($page >= $pages) { $from = 2; $to = $pages-1; } else { if($from = $pages) { $from = $pages-($page-2); $to = $pages-1; } $more = 1; } if($urlrule == '') $urlrule = url_par('page={$page}'); $multipage .= '总数:'.$num.' '; if($curr_page>0) { $multipage .= $catid ? '上一页' : '上一页'; if($curr_page==1) { $multipage .= '1 '; } elseif($curr_page>6 && $more) { $multipage .= $catid ? '1..' : '1..'; } else { $multipage .= $catid ? '1' : '1 '; } } for($i = $from; $i category($catid, $i, 1, 1).'">'.$i.' ' : ''.$i.' '; } else { $multipage .= ' '.$i.' '; } } if($curr_pagecategory($catid, $pages, 1, 1).'">'.$pages.' 下一页' : '..'.$pages.' 下一页'; } else { $multipage .= $catid ? ''.$pages.' 下一页' : ''.$pages.' 下一页'; } } elseif($curr_page==$pages) { $multipage .= ' '.$pages.'下一页'; } } return $multipage; } else { $total = $num; $page = $curr_page; if($num category($catid, 1, 1, 1); $prepage = $url->category($catid, $prepage, 1, 1); $nextpage = $url->category($catid, $nextpage, 1, 1); $lastpage = $url->category($catid, $pages, 1, 1); $urlpre = $url->category($catid, '', 1, 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; } }