想修改PHPCMS分頁的URL 有好人嗎?該怎麼解決

來源:互聯網
上載者:User
想修改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 .= '總數:'.$num.'  ';            if($curr_page>0)            {                $multipage .= $catid ? 'category($catid, $curr_page-1, 1, 1).'">上一頁' : '上一頁';                                if($curr_page==1)                {                    $multipage .= '1 ';                }                elseif($curr_page>6 && $more)                {                    $multipage .= $catid ? 'category($catid, 1, 1, 1).'">1..' : '1..';                }                else                {                    $multipage .= $catid ? 'category($catid, 1, 1, 1).'">1' : '1 ';                }            }            for($i = $from; $i <= $to; $i++)            {                if($i != $curr_page)                {                    $multipage .= $catid ? 'category($catid, $i, 1, 1).'">'.$i.' ' : ''.$i.' ';                }                else                {                    $multipage .= ' '.$i.' ';                }            }            if($curr_page<$pages)            {                if($curr_page<$pages-5 && $more)                {                    $multipage .= $catid ? '..category($catid, $pages, 1, 1).'">'.$pages.' category($catid, $curr_page+1, 1).'">下一頁' : '..'.$pages.' 下一頁';                }                else                {                    $multipage .= $catid ? 'category($catid, $pages, 1, 1).'">'.$pages.' category($catid, $curr_page+1, 1, 1).'">下一頁' : ''.$pages.' 下一頁';                }            }            elseif($curr_page==$pages)            {                $multipage .= ' '.$pages.'下一頁';            }        }        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;    }} 
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.