Skip to content

Commit

Permalink
[DOC] add example fluid usage for both paginators
Browse files Browse the repository at this point in the history
  • Loading branch information
DaRealFreak committed Jul 15, 2022
1 parent ebd99ca commit adb0d31
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ $paginator = new BucketPaginator(
$pagination = new NumberedPagination($paginator, $maximumLinks);
```

You can retrieve the bucket contents and additional items freely during the template as well:
```html
<f:if condition="{pagination.paginator.additionalContent.filter}">
You filtered for {pagination.paginator.additionalContent.filter.title}
<br/>
(Bucket ID: {pagination.paginator.bucketId})
<br/>
</f:if>
<hr/>

<f:for each="{pagination.paginator.paginatedItems}" as="item">
{item.title}
<br/>
</f:for>
```

### FromDataSourcePaginator
Another option (f.e. due to storage reasons or to refresh results) would be to use the `FromDataSourcePaginator`
to generate the items we are paginating over from the bucket contents.
Expand Down Expand Up @@ -80,5 +96,21 @@ $paginator = new FromDataSourcePaginator(
$pagination = new NumberedPagination($paginator, $maximumLinks);
```

Here you can also retrieve the bucket content as well:
```html
<f:if condition="{pagination.paginator.bucketContent.filter}">
You filtered for {pagination.paginator.bucketContent.filter.title}
<br/>
(Bucket ID: {pagination.paginator.bucketId})
<br/>
</f:if>
<hr/>

<f:for each="{pagination.paginator.paginatedItems}" as="item">
{item.title}
<br/>
</f:for>
```

## License
This project is licensed under the GPL v3.0 - see the [LICENSE](LICENSE) file for details

0 comments on commit adb0d31

Please sign in to comment.