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