Vineet Sawant Posted August 7, 2023 Share Posted August 7, 2023 Hi, So I've created a simple API which takes in following GET parameters m = master/page parent l = limit (no. of results) p = page number My simple questions is, what kind of selector I use so as to get results from a specific page number. For example, if I've 10 records of Employees and "I" set limit as 5 and "p" as 2, I want to get employees with serial number 6-10. Thanks for your help. Link to comment Share on other sites More sharing options...
Vineet Sawant Posted August 7, 2023 Author Share Posted August 7, 2023 I've found the answer in https://cheatsheet.processwire.com/ I'm using "start" parameter in selectors. $emps = $pages->find("template=employee, limit={$l}, start={$p}, sort=-id"); It's working. Link to comment Share on other sites More sharing options...
wbmnfktr Posted August 7, 2023 Share Posted August 7, 2023 2 hours ago, Vineet Sawant said: start={$p} That would actually be the start in the page array. To get a specific page, based on a selector with start and limit, you might want to look at this: https://processwire.com/api/ref/wire-input/page-num/ This way you can actually go straight to the specific page, like 3 of 7. 2 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