>백엔드 개발 >PHP 튜토리얼 > 想修改PHPCMS分页的URL 有好人吗?该怎么解决

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

WBOY
WBOY원래의
2016-06-13 13:52:08780검색

想修改PHPCMS分页的URL 有好人吗?

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
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 .= '总数:<b>'.$num.'</b>  ';

            if($curr_page>0)
            {
                $multipage .= $catid ? '<a href="'.%24url->category(%24catid,%20%24curr_page-1,%201,%201).'">上一页</a>' : '<a href="'.pageurl(%24urlrule,%20%24curr_page-1,%20%24array).'">上一页</a>';
                
                if($curr_page==1)
                {
                    $multipage .= '<u><b>1</b></u> ';
                }
                elseif($curr_page>6 && $more)
                {
                    $multipage .= $catid ? '<a href="'.%24url->category(%24catid,%201,%201,%201).'">1</a>..' : '<a href="'.pageurl(%24urlrule,%201,%20%24array).'">1</a>..';
                }
                else
                {
                    $multipage .= $catid ? '<a href="'.%24url->category(%24catid,%201,%201,%201).'">1</a>' : '<a href="'.pageurl(%24urlrule,%201,%20%24array).'">1</a> ';
                }
            }
            for($i = $from; $i category($catid, $i, 1, 1).'">'.$i.' ' : '<a href="'.pageurl(%24urlrule,%20%24i,%20%24array).'">'.$i.'</a> ';
                }
                else
                {
                    $multipage .= ' <u><b>'.$i.'</b></u> ';
                }
            }
            if($curr_pagecategory($catid, $pages, 1, 1).'">'.$pages.' <a href="'.%24url->category(%24catid,%20%24curr_page+1,%201).'">下一页</a>' : '..<a href="'.pageurl(%24urlrule,%20%24pages,%20%24array).'">'.$pages.'</a> <a href="'.pageurl(%24urlrule,%20%24curr_page+1,%20%24array).'">下一页</a>';
                }
                else
                {
                    $multipage .= $catid ? '<a href="'.%24url->category(%24catid,%20%24pages,%201,%201).'">'.$pages.'</a> <a href="'.%24url->category(%24catid,%20%24curr_page+1,%201,%201).'">下一页</a>' : '<a href="'.pageurl(%24urlrule,%20%24pages,%20%24array).'">'.$pages.'</a> <a href="'.pageurl(%24urlrule,%20%24curr_page+1,%20%24array).'">下一页</a>';
                }
            }
            elseif($curr_page==$pages)
            {
                $multipage .= ' <u><b>'.$pages.'</b></u><a href="'.pageurl(%24urlrule,%20%24curr_page,%20%24array).'">下一页</a>';
            }
        }
        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;
    }
}

 <div class="clear">
                 
              
              
        
            </div>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.