Jump to content

Getting page position and next page within a pageField

Recommended Posts

I'm attempting to set up a 'NEXT PROJECT' link which is based on which category a project is in; so depending if the user accesses the project directly, or from the category page, the 'NEXT PROJECT' link should be based on either the next project in general OR the next project in that category. Projects are all entered under one tree and categories on another then I'm using a pageField to connect them.

My question.

Is there a way to get the next item (or first if the current item is last) from the current project's position in the pageField? I can get the pageField from the category page (which has all the projects) but I'm struggling to work out how I can find the project's position in that pageField then return either the next or first project in the list.

Any thoughts? I tried searching the pageField for the current project but then all that does it return the project as a page and not within the pageField.

Thanks in advance.

Share this post

Link to post
Share on other sites

Turns out getNext() works on the pageField whereas next isn’t contextually aware (so it gets the next item in the parent rather than in the pageField)

  • Like 1

Share this post

Link to post
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...