2

我真的对 Zend_Paginator 的工作方式感到困惑......

$dbProducts = $this->_table->fetchAll($this->_table->select());
//$dbProducts = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($this->_table->select()));
//$dbProducts->setItemCountPerPage(4);
//$dbProducts->setCurrentPageNumber(1);

计数($dbProducts)返回 27...

//$dbProducts = $this->_table->fetchAll($this->_table->select());
$dbProducts = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($this->_table->select()));
//$dbProducts->setItemCountPerPage(4);
//$dbProducts->setCurrentPageNumber(1);

count($dbProducts) 返回 3...

//$dbProducts = $this->_table->fetchAll($this->_table->select());
$dbProducts = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($this->_table->select()));
$dbProducts->setItemCountPerPage(4);
$dbProducts->setCurrentPageNumber(1);

计数($dbProducts)返回 7...

4

1 回答 1

7

对于 Zend Pagination, http: //zendgeek.blogspot.com/2009/07/zend-pagination-example.html有一个简单的例子。这个集成很简单,试试吧.......

读完试试这个,

        $page = $this->_getParam('page', 1);
        $paginator = Zend_Paginator::factory($dbProducts);
        $paginator->setItemCountPerPage(20);
        $paginator->setCurrentPageNumber($page);

        $this->view->records = $paginator;
于 2011-04-20T10:54:06.187 回答