与 Zend_Paginator 混淆

发布于 2024-11-02 14:01:01 字数 1043 浏览 5 评论 0原文

我真的很困惑 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) 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...

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->setCurrentPageNumber(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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

百思不得你姐 2024-11-09 14:01:01

对于 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;

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;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文