a-ok Posted November 13, 2017 Share Posted November 13, 2017 Does the "start" selector property still work? http://cheatsheet.processwire.com/selectors/built-in-page-selector-properties/start-n/ I am doing the following but doesn't seem to have any bearing... $articles = $pages->find("template=meet-the-locals-detail, start=3, sort=sort"); I liked modifying the selector query, rather than the results (with slice) as presumably it's a lot more efficient. Link to comment Share on other sites More sharing options...
heldercervantes Posted November 13, 2017 Share Posted November 13, 2017 Someone more knowledgeable than me may clarify the why, but it seems you need to combine start with limit. This is for pagination purposes, and it makes sense in that context. I guess it "could" assume an infinite limit by default, but as I said someone more knowledgeable may point out a good reason why it shouldn't. So just put a limit of whatever large number you feel comfortable and it should work. This code works for me: $pl = $pages->find('template=basic-page, start=3, limit=3'); Also, you don't need to set `sort=sort`, that's the default behaviour (see correction below). However if these pages you're grabbing are not children of the same page, you'll have a whole new problem to deal with. 2 Link to comment Share on other sites More sharing options...
Robin S Posted November 13, 2017 Share Posted November 13, 2017 6 hours ago, heldercervantes said: Also, you don't need to set `sort=sort`, that's the default behaviour. Just a correction to this (from the docs): Quote How to force pages to sort by their admin order with $pages->find() Unlike $page->children(), the $pages->find() function does not automatically sort by the order they appear in the site tree. This is because $pages->find() is not limited to finding pages specific to one parent, so it may be pulling pages from multiple places (according to your selector). If your parent page(s) are not already sorting by a specific field, you may still tell the $pages->find() to sort by the parent's order by specifying "sort=sort" in your selector. This is the same as saying "sort by whatever order I dragged the pages to in the admin." But note that if the results have multiple parents, the resulting order isn't likely to be useful. 2 Link to comment Share on other sites More sharing options...
heldercervantes Posted November 14, 2017 Share Posted November 14, 2017 Thanks for the correction @Robin S, have to admit I spoke off the top of my head on that one. Link to comment Share on other sites More sharing options...
a-ok Posted November 15, 2017 Author Share Posted November 15, 2017 Thanks guys. Really appreciate it... so the only way to set the start is to include limit? That's good to know. 1 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