首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

想修改PHPCMS分页的URL 有好人吗?该怎么解决

2012-02-13 
想修改PHPCMS分页的URL 有好人吗?PHP codefunction pages($num, $curr_page, $perpage 20, $urlrule

想修改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 <= 1)                {                    $to = $page-1;                    $from = 2;                }                elseif($to >= $pages)                {                    $from = $pages-($page-2);                    $to = $pages-1;                }                $more = 1;            }            if($urlrule == '') $urlrule = url_par('page={$page}');            $multipage .= '总数:<b>'.$num.'</b>&nbsp;&nbsp;';            if($curr_page>0)            {                $multipage .= $catid ? '<a href="'.$url->category($catid, $curr_page-1, 1, 1).'">上一页</a>' : '<a href="'.pageurl($urlrule, $curr_page-1, $array).'">上一页</a>';                                if($curr_page==1)                {                    $multipage .= '<u><b>1</b></u> ';                }                elseif($curr_page>6 && $more)                {                    $multipage .= $catid ? '<a href="'.$url->category($catid, 1, 1, 1).'">1</a>..' : '<a href="'.pageurl($urlrule, 1, $array).'">1</a>..';                }                else                {                    $multipage .= $catid ? '<a href="'.$url->category($catid, 1, 1, 1).'">1</a>' : '<a href="'.pageurl($urlrule, 1, $array).'">1</a> ';                }            }            for($i = $from; $i <= $to; $i++)            {                if($i != $curr_page)                {                    $multipage .= $catid ? '<a href="'.$url->category($catid, $i, 1, 1).'">'.$i.'</a> ' : '<a href="'.pageurl($urlrule, $i, $array).'">'.$i.'</a> ';                }                else                {                    $multipage .= ' <u><b>'.$i.'</b></u> ';                }            }            if($curr_page<$pages)            {                if($curr_page<$pages-5 && $more)                {                    $multipage .= $catid ? '..<a href="'.$url->category($catid, $pages, 1, 1).'">'.$pages.'</a> <a href="'.$url->category($catid, $curr_page+1, 1).'">下一页</a>' : '..<a href="'.pageurl($urlrule, $pages, $array).'">'.$pages.'</a> <a href="'.pageurl($urlrule, $curr_page+1, $array).'">下一页</a>';                }                else                {                    $multipage .= $catid ? '<a href="'.$url->category($catid, $pages, 1, 1).'">'.$pages.'</a> <a href="'.$url->category($catid, $curr_page+1, 1, 1).'">下一页</a>' : '<a href="'.pageurl($urlrule, $pages, $array).'">'.$pages.'</a> <a href="'.pageurl($urlrule, $curr_page+1, $array).'">下一页</a>';                }            }            elseif($curr_page==$pages)            {                $multipage .= ' <u><b>'.$pages.'</b></u><a href="'.pageurl($urlrule, $curr_page, $array).'">下一页</a>';            }        }        return $multipage;    }    else    {        $total = $num;        $page = $curr_page;        if($num < 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, 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;    }} 



弄了几天了.还是弄不懂
$multipage .= $catid ? '<a href="'.$url->category($catid, $curr_page-1, 1, 1).'">上一页</a>' : '<a href="'.pageurl($urlrule, $curr_page-1, $array).'">上一页</a>';
这一句
$url->category($catid, $curr_page-1, 1, 1)
引用的是哪里..

[解决办法]
引用的是这个:$url = load('url.class.php'); 文件中的类。

热点排行