Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
Is there some sort of a "pagelimit" to set for the clickable pages of the paginator?

Assuming we have a paginator set for a blog with a limit for 5 pages and it has 50 posts in total.
This will set the paginator to 10 clickable numbers.

question
Is it possible to limit the numbers with eg. dots or and to set a certain range so it only covers like a certain limit of pages.

example explained
Let's assume we have 500 posts and 12 here is the current page. This would result in 100 clickable pages in the paginator. So is its possible to create something like this or something alike?
first << ... 9 10 11 12 13 14 15 ... >> last
clicking on 14 would result in:
first << ... 11 12 13 14 15 16 17 ... >> last


Code: Select all
<cms:pages masterpage='nieuws.php' paginate='1' limit='1' pagelimit="7">
...
</cms:pages>


ps: remark "pagelimit" isn't a valid parameter and showed only to explain the issue itself.
ps2: This looks like a common problem so I assume there's some kind of answer towards this.

I've looked at: pagination and paginator but can't really find an answer. How does it deal with those issues right now out of the box (showing all)?
Let's assume we have 500 posts and 12 here is the current page. This would result in 100 clickable pages in the paginator.

Actually, with the default configuration, it would result in only 7 clickable pages which is the maximum you'll have whatever the total number of posts being handled.

Taking your example (total 500 posts with 5 on each page so 100 pages), this is how the paginator would look like as we move from the first pages, through the middle ones onto the last -
1 2 3 4 5 ... 99 100

1 2 ... 11 12 13 ... 99 100

1 2 ... 96 97 98 99 100

You may, if you wish, increase that maximum number of clickable blocks from 7 to any other higher figure by using the 'adjacents' parameter of the cms:paginator tag (http://www.couchcms.com/docs/tags-refer ... nator.html).

I suppose, this should be ample for most situations.
What do you say? Do let me know.

Thanks.
Thanks, that covers it. Wasn't really aware what the adjacent parameter involved exactly.
I am glad :)

The 'adjacents' parameter can do with some explanation -
looking at the three examples in my last post, we can see that the paginator always shows the first two and the last two pages. The red highlighted page is the current one and if you notice, in all the three cases it is flanked on both sides by one additional page. This is the 'adjacents' parameter at work with the default setting of '1'.

If suppose we change the value to '2', the current page will have 2 adjacent pages on each side and with the 2 starting and 2 ending pages, we'll end up always showing 9 pages instead of the default 7 -
2 starting + 2 left adjacent + 1 current + 2 right adjacent + 2 ending = 9

Hope I was able to make myself clear.

Thanks.
Got it!

Building upon previous example and summarized:
green color: default values that come with the paginator tag.
red color: current location.
blue color: adjacent parameter in action according to its value.

Code: Select all
<cms:paginator />

would result in: 1 2 ... 11 12 13 ... 99 100

Code: Select all
<cms:paginator adjacent='3' />

would result in: 1 2 ... 9 10 11 12 13 14 15 ... 99 100

Code: Select all
<cms:paginator adjacent='1' />

would result in: the same as default (without adjacent parmeter = first example, explained here)
1 2 ... 11 12 13 ... 99 100
Hi, i tried using this adjacent tag as you have explained but nothing is happening even after I'm setting it's value.
6 posts Page 1 of 1
cron