{paginate_middle}在PHP Smarty分页不能正常工作


{paginate_middle} in PHP Smarty pagination not working properly

我正在使用智能分页,我的分页URL是这样的

categories.php?id=1&next=3

现在{paginate_prev} &{paginate_next}工作正常但是{paginate_middle}是剥离ID参数它生成的url是这样的

categories.php?next=3

我的分页代码在这里

function get_db_results() {
    global $conn;
    $id = htmlspecialchars((int)$_GET['id']);
  if ($id){
  $_query = sprintf('SELECT SQL_CALC_FOUND_ROWS * FROM newser where idblog = '.$conn->qstr($id).' and (main = '.$conn->qstr('0').' or main = '.$conn->qstr('2').')  ORDER BY blogid DESC LIMIT %d,%d',
        SmartyPaginate::getCurrentIndex(),SmartyPaginate::getLimit());
    }
    else
    {
    $_query = sprintf('SELECT SQL_CALC_FOUND_ROWS * FROM newser where (main = '.$conn->qstr('0').' or main = '.$conn->qstr('2').') ORDER BY blogid DESC LIMIT %d,%d',
        SmartyPaginate::getCurrentIndex(),SmartyPaginate::getLimit());
    }
        $brecordSet = $conn->Execute($_query);
        if(!$brecordSet)
            print $conn->ErrorMsg();
        else
            while(!$brecordSet->EOF) {
                $_data[] = $brecordSet->GetRowAssoc(false);
                $brecordSet->MoveNext();
            }
        $_query = "SELECT FOUND_ROWS() as total";
        $crecordSet = $conn->Execute($_query);
        if(!$crecordSet)
            print $conn->ErrorMsg();
        else
            $_row = $crecordSet->GetRowAssoc();
        $total = $crecordSet->fields['total'];
        SmartyPaginate::setTotal($total);
        return @$_data;
        $brecordSet->Close();
        $crecordSet->Close();
    }
    require ('libs/SmartyPaginate.class.php');
    SmartyPaginate::connect();
    SmartyPaginate::setLimit(4);
    SmartyPaginate::setUrl('categories.php');
    $smarty->caching = $caching;
    $smarty->assign('results',get_db_results());
    SmartyPaginate::assign($smarty);
    $id = htmlspecialchars((int)$_REQUEST['id']);
    @$next = htmlspecialchars((int)$_REQUEST['next']);
    $cid = $id.$next;
    $smarty->display('categories.php',$cid);

请帮助我了解是否有任何问题,我的代码或它与smarty {paginate_middle}的错误,这是不处理多个参数

我根本不使用SmartyPaginate,但似乎你应该至少改变这一行:

SmartyPaginate::setUrl('categories.php');

SmartyPaginate::setUrl('categories.php?id=1');