adrianmak Posted January 13, 2016 Posted January 13, 2016 These two api is convenience for developer for next adjacent page of current page. But it only work for, in the order of pages creation How could it possible for, let say I generated a list of pages and sorted by a date field. That's the actual page order listed in the back-end is different from the front-end. if I used $page->prev and $page->next, it reflect the order of the back-end but not the front-end (pages sorted by date) 1
pwired Posted January 13, 2016 Posted January 13, 2016 Use this: http://cheatsheet.processwire.com/pages/built-in-methods-reference/pages-find-selector/
justb3a Posted January 13, 2016 Posted January 13, 2016 This should work: $sortedPages = $pages->find('selector'); $prevPage = $page->prev($sortedPages); $nextPage = $page->next($sortedPages); 3
SiNNuT Posted January 13, 2016 Posted January 13, 2016 As said in other replies, you can feed a pageArray. More info here: http://cheatsheet.processwire.com/page/built-in-fields-reference/page-next/
adrianmak Posted January 14, 2016 Author Posted January 14, 2016 This should work: $sortedPages = $pages->find('selector'); $prevPage = $page->prev($sortedPages); $nextPage = $page->next($sortedPages); Many thanks~~~~
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now