开发者

Confused with Zend_Paginator

开发者 https://www.devze.com 2023-02-27 12:15 出处:网络
I am really confused with how Zend_Paginator works... $dbProducts = $this->_table->fetchAll($this->_table->select());

I am really confused with how Zend_Paginator works...

$dbProducts = $this->_table->fetchAll($this->_table->select());
//$dbProducts = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($this->_table->select()));
//$dbProducts->setItemCountPerPage(4);
//$dbProducts->setCur开发者_StackOverflowrentPageNumber(1);

count($dbProducts) return 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) returns 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);

count($dbProducts) return 7...


For Zend Pagination, http://zendgeek.blogspot.com/2009/07/zend-pagination-example.html is having a simple example. This is very simple to integrate, try it.......

After reading try this,

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

        $this->view->records = $paginator;
0

精彩评论

暂无评论...
验证码 换一张
取 消