DISCUZ 分页代码

/前台分页函数function multi($num, $perpage, $curpage, $mpurl, $maxpages
= 0, $page = 10, $autogoto = TRUE, $simple = FALSE) {//global
$maxpage;$ajaxtarget = !empty($_GET[‘ajaxtarget’]) ?
ajaxtarget=.htmlspecialchars($_GET[‘ajaxtarget’]). : ”;

复制代码 代码如下:/*   
    [Discuz!] (C)2001-2006 Comsenz Inc.   
    This is NOT a freeware, use is subject to license terms   

$multipage = ”;$mpurl .= strpos($mpurl, ‘?’) ? ‘amp;’ : ‘?’;$realpages
= 1;if($num $perpage) {$offset = 2;

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

$realpages = @ceil($num / $perpage);$pages = $maxpages $maxpages
$realpages ? $maxpages : $realpages;//$curpage = $curpage $realpages ?
$curpage : $realpages;

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

if($page $pages) {$from = 1;$to = $pages;} else {$from = $curpage –
$offset;$to = $from + $page – 1;if($from 1) {$to = $curpage + 1 –
$from;$from = 1;if($to – $from $page) {$to = $page;}} elseif($to $pages)
{$from = $pages – $page + 1;$to = $pages;}}

        $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;    
            }    
        }