Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zend Framework Blog:
Paginating data collections with zend-paginator
Feb 02, 2017 @ 16:26:13

The Zend Framework blog has continued with its series of posts highlighting a component of the framework and some of the benefits and functionality it brings to the table. In their latest post they focus on zend-paginator for easy and automatic pagination of results.

zend-paginator is a flexible component for paginating collections of data and presenting that data to users. Pagination is a standard UI solution to manage the visualization of lists of items, like a list of posts in a blog or a list of products in an online store.

zend-paginator is very popular among Zend Framework developers, and it's often used with zend-view, thanks to the pagination control view helper zend-view provides. It can be used also with other template engines. In this article, I will demonstrate how to use it with Plates.

The tutorial starts with the Composer command to get the component pulled into your project and details what all comes with it. It then shows the creation of a custom adapter type (for "Posts"") and how to use the package to paginate through the results with an example of the output here. Then comes the example using the Plates templating framework via a "PaginatorMiddleware" middleware, a simple template using the pagination object directly and inserting the page navigation via a partial (again making use of the object but getting the values needed to build out the links).

tagged: zendframework pagination zendpaginator plates templating tutorial

Link: https://framework.zend.com/blog/2017-01-31-zend-paginator.html


Trending Topics: