Home > php教程 > php手册 > DISCUZ 分页代码

DISCUZ 分页代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:34:35
Original
1439 people have browsed it

复制代码 代码如下:

/*   
    [Discuz!] (C)2001-2006 Comsenz Inc.   
    This is NOT a freeware, use is subject to license terms   

    $RCSfile: global.func.php,v $   
    $Revision: 1.83.2.7 $   
    $Date: 2006/10/27 08:08:18 $   
*/   

function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0) {    
    $multipage = '';    
    $mpurl .= strpos($mpurl, '?') ? '&' : '?';    
    if($num > $perpage) {    
        $page = 10;    
        $offset = 2;    

        $realpages = @ceil($num / $perpage);    
        $pages = $maxpages && $maxpages 
        if($page > $pages) {    
            $from = 1;    
            $to = $pages;    
        } else {    
            $from = $curpage - $offset;    
            $to = $from + $page - 1;    
            if($from                 $to = $curpage + 1 - $from;    
                $from = 1;    
                if($to - $from                     $to = $page;    
                }    
            } elseif($to > $pages) {    
                $from = $pages - $page + 1;    
                $to = $pages;    
            }    
        }    

        $multipage = ($curpage - $offset > 1 && $pages > $page ? '|?' : '').    
            ($curpage > 1 ? '??' : '');    
        for($i = $from; $i             $multipage .= $i == $curpage ? ''.$i.'' :    
                ''.$i.'';    
        }    

        $multipage .= ($curpage ??' : '').    
            ($to ?|' : '').    
            ($curpage == $maxpages ? '??' : '').    
            ($pages > $page ? '' : '');    

        $multipage = $multipage ? '

' : '';    
    }    
    return $multipage;    
}    
?>   
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php - discuz single sign-on problem
From 1970-01-01 08:00:00
0
0
0
How to install discuz in phpStudy
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template