adrianmak Posted January 13, 2016 Share 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 Link to comment Share on other sites More sharing options...
pwired Posted January 13, 2016 Share Posted January 13, 2016 Use this: http://cheatsheet.processwire.com/pages/built-in-methods-reference/pages-find-selector/ Link to comment Share on other sites More sharing options...
justb3a Posted January 13, 2016 Share Posted January 13, 2016 This should work: $sortedPages = $pages->find('selector'); $prevPage = $page->prev($sortedPages); $nextPage = $page->next($sortedPages); 3 Link to comment Share on other sites More sharing options...
SiNNuT Posted January 13, 2016 Share 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/ Link to comment Share on other sites More sharing options...
adrianmak Posted January 14, 2016 Author Share Posted January 14, 2016 This should work: $sortedPages = $pages->find('selector'); $prevPage = $page->prev($sortedPages); $nextPage = $page->next($sortedPages); Many thanks~~~~ Link to comment Share on other sites More sharing options...
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