Limit Pagination with Concrete5 5.7

Permalink
Can some tell me how to limit pagination results in Concrete5 5.7+

haundavid
 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi haundavid,

What type of pagination results are you trying to limit?
haundavid replied on at Permalink Reply
haundavid
Currently there seems to be X pages listed: 1 2 3 4 5 [6] 7 8 9 10 11. There seems to be a certain number of pages listed before and after the page selected. I would like the ability to change X so I could have some thing like: 4 5 [6] 7 8, and dictate how many pagination pages are actually displayed.

I've seen several options for changing this for C5 5.6 and earlier, but I have not been able to find a solution for C5 5.7+
hutman replied on at Permalink Reply
hutman
Can you explain what you mean by limit pagination? Like you only want to show the first X pages or what are you trying to do?
haundavid replied on at Permalink Reply
haundavid
Yes, I would like the ability to change X so I could have some thing like: 4 5 [6] 7 8, and dictate how many pagination pages are actually displayed.

I've seen several options for changing this for C5 5.6 and earlier, but I have not been able to find a solution for C5 5.7+
korxz replied on at Permalink Reply
Hi,
have you found a solution? I'm facing the same problem as you were.

Thanks for your help.
haundavid replied on at Permalink Reply
haundavid
Sorry, I have not found a solution.
mnakalay replied on at Permalink Best Answer Reply
mnakalay
PagerFanta, the script behing C5 pagination has a "proximity" option. That option is then used in a function named calculateStartAndEndPage().

That aptly named function uses the proximity option to decide how many pages to show before and after the current page.

I believe that's what you need?
korxz replied on at Permalink Reply
Yep that's what I needed. Still not 100% how everything is working but I managed to fix my problem.
So here is where it's defined in DefaultView.php
private function initializeOptions($options) {
  $this->proximity;
}

Then in my view.php
$options = array(
  'proximity' => 'number of pages you want to display next to active'
);
echo $pagination->renderDefaultView($options);


This bit of code worked for my problem. If example helps anyone. I also added some jQuery for changes on mobile.

Thanks again mnakaly!
mnakalay replied on at Permalink Reply
mnakalay
You are very welcome