Jump to content

Can I return next 5 pages and previous 5 pages?


Recommended Posts

I don't know of a built in way but I'm happy to learn 🙂

Not sure if that's the best way to do it but it works:

$i = 0;
$prev = new PageArray();
$next = new PageArray();
$p = $n = $page;
while($i++ < 5) {
    if($p and $p = $p->prev and $p->id) $prev->add($p);
    if($n and $n = $n->next and $n->id) $next->add($n);
db($prev, "prev");
db($next, "next");


  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...