Search code examples
phpzend-frameworkzend-paginator

How do you output the Zend pagination control outside of the view?


I'm creating a wrapper class in the Zend framework to encapsulate some data output and the pagination control.

How do I output this line from the view in the controller:

<?= $this->paginationControl($this->oPaginator, 'Sliding', 'pagination-control.phtml')?>

Thanks in advance.

...Answered my own question:

$this->view->oPaginator = $this->oPaginator;
echo $this->view->paginationControl($this->view->oPaginator, 'Sliding', 'pagination-control.phtml');

Solution

  • You can access the view object in the controller with $this->view. So you should be able to echo it like this:

    echo $this->view->paginationControl($this->view->oPaginator, 'Sliding', 'pagination-control.phtml');
    

    But I think there something wrong with your application if you need to echo this in the controller. Why do you want to do this?