gpt4 book ai didi

php - 与 Zend_Paginator 混淆

转载 作者:行者123 更新时间:2023-12-04 20:20:03 24 4
gpt4 key购买 nike

我真的对 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);

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

count($dbProducts) 返回 7...

最佳答案

对于 Zend 分页,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;

关于php - 与 Zend_Paginator 混淆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5727739/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com