Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

How do I get two paginated lists within the same page? #161

Open
mario6097 opened this issue Jul 9, 2017 · 1 comment
Open

How do I get two paginated lists within the same page? #161

mario6097 opened this issue Jul 9, 2017 · 1 comment

Comments

@mario6097
Copy link

mario6097 commented Jul 9, 2017

I am working with Symfony 3 and PagerFanta. I have a quick question.

In a web page I wish to paginate two lists of items. I use PagerFanta to paginate. It works very fine to paginate a list of items (say, posts of a blog), but I do not see how to have two within the same page, (i.e. the same controller).

For the single case, PagerFante create urls as mypath/{page}. It seems I need something like mypath/{page}/{page_bis}, but I do not see how to get that by PagerFanta. Is that possible at all?

At https://packagist.org/packages/white-october/pagerfanta-bundle I read that "the routes are generated automatically for the current route using the variable "page" to propagate the page number." Does it mean that {page} is hardcoded somewhere (where?), and I am not going to be able to use two different {page} and {page_bis}? Could it be hacked somehow easily?

Thanks
mario

@sampart
Copy link
Owner

sampart commented Jul 18, 2017

You can specify a different variable name for the page parameter when rendering your Pagerfanta in your Twig template. Here's an example:

<div class="pagerfanta">
    {{ pagerfanta(my_pager, 'default', {'pageParameter': '[page_bis]'}) }}
</div>

Note the square brackets around page_bis; this won't work without them.

Hope that this helps,
Sam

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants