Closed dirkjf closed 6 years ago
Hi @albawan. I can only think of a couple of ways of doing this:
A variant of (2) - if you're using Symfony, you could use the Pagerfantabundle which has an associated Twig extension, allowing you to specify the proximity in the template itself.
I appreciate that neither of these is an ideal solution, but hopefully this is better than nothing.
Thanks Sam
Hi Sam,
Thank you so much for your suggestions. I managed to improve it by overriding the template in the following fashion:
'prev_message' => '← <span class="d-none d-sm-inline">Previous</span>',
'next_message' => '<span class="d-none d-sm-inline">Next</span> →',
This hides the words "previous" and "next" on small displays.
That combined with the proximity setting in twig (yes, I use the Pagerfantabundle) at least makes it so that on a mobile device it fits. For those wanting to know how to set the proximity in twig, this is how it is done: {{ pagerfanta(paginator, 'my', { 'proximity': 1}) }}
If anyone wants to see a dynamic example, I use it on this page. It's not exactly what I had in mind, but it works quite well.
@albawan thanks so much for sharing how you did this; I'm sure that'll be really useful for others. Are you happy to close this issue now?
@sampart, of course, I'll close it. Thanks again for your suggestions.
I am using the paginator with the bootstrap 4 template, which looks like this:
The issue is that on a mobile phone this does not fit. Is there a way to limit the 1, 2, 3, 4, 5, 6, 7, ... 18 to perhaps 1, 2 ... 17, 18 on mobile only? On a bigger display the original looks fine. I know I could change the proximity setting, but that doesn't really do the trick for a dynamic display.