【问题标题】:How to get all items after Zend Paginator endsZend Paginator 结束后如何获取所有项目
【发布时间】:2013-10-15 13:47:31
【问题描述】:

我在 indexController 中构建了 Zend Paginator。在前端列出了每页 20 个类别,但我也有一个必须列出所有主要类别的下拉列表。有没有办法使用相同的查询?这是我迄今为止尝试过的:

$query = $categories->select()
        ->where($status)
        ->where($sq)
        ->order($this->view->sortoptions->by . ' ' . $this->view->sortoptions->order);


    $this->view->categories = $categories->paginate($query->where($cat), $this->view->LayoutSettings->pagination->itemsperpage , $page);
    $this->view->categoriesall = $categories->fetchAll($query->where("parent = 0")); // we get this for the categories listing in the dropdown

** $status 和 $sq 是过滤参数(例如 parent = 0)

【问题讨论】:

    标签: php zend-framework zend-paginator


    【解决方案1】:

    您必须执行查询,因为 zend 分页器不会获取所有记录 - 它会一次获取 $itemsperpage 条记录!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-26
      • 1970-01-01
      • 1970-01-01
      • 2020-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多