[TYPO3-mvc] How to setup a pagination?

Franz Koch typo3.RemoveForMessage at elements-net.de
Fri Jul 2 15:11:57 CEST 2010


Hi,

> I need to implement a pagebrowser in my extension. Does anybody did this
> before and has come up with an easy, maybe generic, way to handle this?
> Or even better already built a custom ViewHelper for this?

IIRC this has been asked already some time ago.
I'm not sure if it's best practice, but back then I created a pager (or 
pagebrowser) and a page object for that (no domain objects though) as 
well as a viewHelper. To my viewHelper I can either pass a prepared 
pager from my controller (f.e. if you need to browse records by ID and 
not pages in their regular meaning) or feed it with common data like 
"totalItemCount", "itemsPerPage" and additonal arguments for the links 
(like when you need to keep some filter parameters). My viewHelper is 
then building the pager/page objects on the fly, if no prepared pager 
was passed.

The rendering is then done by a basic forViewHelper and some 
ifViewhelpers. For ease of use in Fluid my pagerObject provides some 
additional getters like "getFirstPage", "getLastPage", "getPreviousPage" 
etc.

Hope that helps.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list