首页 > 开发 > PHP > 正文

DISCUZ 分页代码

2024-05-04 22:14:02
字体:
来源:转载
供稿:网友

代码如下:<?php    
/*   
    [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 < $realpages ? $maxpages : $realpages;    

        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;    

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表