Kirby Pagejump - Step pages without ending walls

Require Kirby 2.3.

It’s based on “Jump step in a collection of pages - Back and forward”.

In a template or a snippet it’s possible to use $page->prev() and $page->next(). When at the end of a collection you will be hit by the end wall.

Sometimes it can be good not be bound by the walls. When using $page->jump($steps) you can step any direction and always get a page.

It’s similar to how an image slider or an ad rotator works.

For example you can do this:

echo $page->jump(-1)->title(); // Jump back one page in the collection
echo $page->jump(5)->title(); // Jump forward 5 steps

If there are only 3 pages the $page->jump(5) will still echo a title because it will start over.


You’re an unstoppable plugin machine! :wink:


:smiley: This time I even was fast enough to post it to Kirby Plugins before you did. It’s not every time that happends. :wink:

1 Like