Jump to content

Next and previous links for sibling pages


nikoka
 Share

Recommended Posts

Hi there,

Building my first site with PW and everything's coming together nicely, so thanks for a wonderful CMS. There's one thing that has got me a bit stumped though. I need to create a navigation between a group of sibling pages (at the moment I identify this group by using a selector). The navigation consists of just two links, "previous page" and "next page", what would be the best way to do this? These pages will also have sub pages and the navigation will be used there too. 

Any hints or code would be greatly appreciated. Thanks!

Link to comment
Share on other sites

Nikoka,

Welcome to the ProcessWire forums. Thanks for your nice feedback.

It sounds like you might be talking about pagination? If so, see this:

http://processwire.com/api/modules/markup-pager-nav/

Every page also has $page->next and $page->prev, which refer to the next and previous sibling page. That use useful if you want to step through them sequentially in your UI. But you mentioned a group of sibling pages, so I'm thinking the pagination link above is probably more what you are looking for?

Also, see the second half of this post, where it talks about using 'next' and 'previous' links instead of the numbered pagination:

http://processwire.com/talk/index.php/topic,28.msg53.html#msg53

Let me know if this is what you were looking for, or if you meant something different?

Thanks,

Ryan

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
 Share

  • Recently Browsing   0 members

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