[FLOW3-general] Problems with Paginate widget
Bernhard Fischer
bernhard at fischli.org
Tue Nov 29 13:44:39 CET 2011
On 11/29/2011 01:06 PM, Matthias Habegger wrote:
> Hi there,
>
> I'm struggling with the same problem.
>
> I have a controller called "BookController" with an action method called
> "searchAction" without any parameters.
> --
> public function searchAction() {
> $this->view->assign('books', $this->bookRepository->findAll());
> }
> --
>
> To call this action I use the URL
> "http://dev.library.local/habex.library/book/search"
>
>
> The template looks like this (shortened ;-) ):
> --
> <f:widget.paginate objects="{books}" as="paginatedBooks"
> configuration="{itemsPerPage: 3}">
> <f:for each="{paginatedBooks}" as="book">
> {book.title}
> </f:for>
> </f:widget.paginate>
> --
>
> I studied the blog example and the other example that Bernhard postet,
> but I couldn't get it work.
>
> I don't have any routes configured yet.
It's a must-have. The widget has to know e.g. which page to show. Those
additional arguments will be handled by a customized routing.
>
> How should the Route looks like?
You have setup two routes. One for the first page and a second one for
the remaining pages.
-
name: 'Books Pagination'
uriPattern:
'habex.library/book/search/books/page/{@widget_0.currentPage}'
defaults:
'@controller': 'Book'
'@action': 'search'
'@widget_0':
'@controller': ''
'@package': ''
-
name: 'Books Pagination - First Page'
uriPattern: 'habex.library/book/search/books'
defaults:
'@controller': 'Book'
'@action': 'search'
'@widget_0':
'@controller': ''
'@package': ''
You also have to introduce your subroutes in the global Routes.yaml
-
name: 'Habex.Library'
uriPattern: '<HabexLibrarySubroutes>'
defaults:
'@package': 'Habex.Library'
'@format': 'html'
subRoutes:
HabexLibrarySubroutes:
package: Habex.Library
>
>
> Thanks,
> Matthias
>
More information about the FLOW3-general
mailing list