1

我在 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)

4

1 回答 1

0

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

于 2013-10-15T05:47:31.677 回答