Tyssen Posted July 31, 2020 Share Posted July 31, 2020 I'm trying to output a long list of pages. If I do this: $subpages = $pages->get('/shop/products/')->child->children; the output is limited to 50 items. If I do this: $subpages = $pages->get('/shop/products/')->child->children('limit=9999'); the output is also limited to 50. But if I enter any number less than 50, then that's how many get displayed. What am I missing? Link to comment Share on other sites More sharing options...
teppo Posted July 31, 2020 Share Posted July 31, 2020 Just checking: are you absolutely sure that this method returns only 50 items? Do you have any hooks or modules that could affect this... and are you checking right after, i.e. there's no possibility that the list of items was filtered before you check the number of returned items? $page->children() should return all the children (according to docs too) ? Link to comment Share on other sites More sharing options...
Tyssen Posted August 1, 2020 Author Share Posted August 1, 2020 I'm outputting the items in an ordered list so that's showing the count for me. The max number it displays is 50. I've temporarily disabled the site's prepend and append files so the only thing showing on the page now is the output from the selector I posted above. Are there any config settings either in config.php or in the admin which might restrict the number? Link to comment Share on other sites More sharing options...
Jan Romero Posted August 1, 2020 Share Posted August 1, 2020 (edited) With your code you’re only getting the children of /shop/products/’s FIRST child. Is that what you expect? If you want all grandchildren of /shop/products/, you could do something like $products = $pages->find('parent.parent.path=/shop/products/'); (Sorry if that’s not 100%, I just got up lol) Edited August 2, 2020 by Jan Romero added missing “.path” in case someone finds this later 2 1 Link to comment Share on other sites More sharing options...
Tyssen Posted August 1, 2020 Author Share Posted August 1, 2020 Thanks, that was it. ? parent.parent didn't work but I did a find on the template instead. 1 Link to comment Share on other sites More sharing options...
Jan Romero Posted August 2, 2020 Share Posted August 2, 2020 Indeed, sorry. For the record, selecting by grandparent would work like this: $products = $pages->find('parent.parent.path=/shop/products/'); 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