如何在Zend Paginator结束后获得所有项目

时间:2021-02-06 12:34:47

I have built a Zend Paginator in my indexController. On the frontend there are listed the categories 20 per page but I also have a dropdown that has to list all main categories. Is there a way to use the same query? This is what I have tried so far:

我在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 and $sq are filtering parameter (eg. parent = 0)

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

1 个解决方案

#1


0  

You will have to execute the query since zend paginator will not fetch all records - it will rather fetch $itemsperpage number of records at a time!

您将不得不执行查询,因为zend paginator不会获取所有记录 - 它将一次获取$ itemsperpage记录数!

#1


0  

You will have to execute the query since zend paginator will not fetch all records - it will rather fetch $itemsperpage number of records at a time!

您将不得不执行查询,因为zend paginator不会获取所有记录 - 它将一次获取$ itemsperpage记录数!