Hello fellow Kirby lovers.
I’m having some trouble with pagination.
So, there is two collection
objects, both contains somes pages of the website.
The first collection (let’s name it $one
) contains some articles.
The second collection (so $two
) contains a lot of blog posts or equiv.
Both are displayed on the home
page, like a ‘two speeds carrousel’. But with sources from different parts of a webiste.
The aim is to show only one item of $one
and 28 items of $two
on each page.
So i’m using the pagination()
of $two
to show and navigate through pages.
As the following :
$one->paginate(1, array('variable' => 'myPagi'));
$two->paginate(28, array('variable' => 'myPagi'));
$pagination = $two->pagination();
Unfortunately, the number of items on each collection doesn’t match at all. Therefor, after an unknown number of pages, $one
will go dry, while $two
will still have items to display. So, pagination break and do not know what to do.
The behavior i’d like to obtain is to freeze $one
's last item after it’s last page , while pagination continue for $two
. So newest items will be displayed, but the $one
will not react to pagination anymore.
Something like :
if ($one->pagination()->countPages() > $two->pagination()->page()) {
$one->pagination()->freeze()
}
Above code is metaphorical.
The thing is : I actually don’t know how to achieve this.
I tried to apply a perpetual offset to $one, but didn’t managed to get it to work.
Could someone help me to get me out of this ?
Or maybe even my logic doesn’t work, or i don’t understand pagination that well.
Any help will be appreciated. And if you need me to give more details, i’ll be happy to.
Love, Wizhou.