Manaus Posted May 20, 2014 Posted May 20, 2014 Hello, I need to grab the bunch of pages and their children, I wonder if I can do it in one shot, or do for each page "do you have children? if so, get them". My fear is in making too many db hits, and slow down the page load Thanks!
Manaus Posted May 22, 2014 Author Posted May 22, 2014 Ok got it, foreach page { if it has children print children } and so on...
diogo Posted August 7, 2014 Posted August 7, 2014 $getTheseAndItsChildren = "1236|1244|1264|1768|1456"; $myPages = $pages->find("id={$getTheseAndItsChildren}, parent={$getTheseAndItsChildren}"); edit: I have to wake up before posting $myPages = $pages->find("id=1236|1244|1264|1768|1456"); echo $myPages->import($pages->find("parent={$myPages}"));
apeisa Posted August 7, 2014 Posted August 7, 2014 Diogo, wouldn't work with that logic. Either two queries or OR selectors (as simple as parenthesis there). On mobile now.
diogo Posted August 7, 2014 Posted August 7, 2014 @appeisa, you're right of course. Already corrected it. 1
diogo Posted August 7, 2014 Posted August 7, 2014 This is working for me in the latest dev! $pages->find("id|parent=1236|1244|1264|1768|1456") The pipe is working also on the left side of the operator. When did Ryan add this? I completely missed it! :) 2
DaveP Posted August 7, 2014 Posted August 7, 2014 @diogo Has that not (almost) always been possible? From http://processwire.com/api/selectors/ - title|body~=sushi tobiko - seems to have been there a long time if memory serves. 2
diogo Posted August 7, 2014 Posted August 7, 2014 Well, damn it! I will refrain from posting for the rest of the day. Maybe tomorrow I will be awaken... Anyway Manaus, there is your answer. Parent and children in one go. 1
apeisa Posted August 7, 2014 Posted August 7, 2014 Of course, clever one Diogo! Rarely needed with page IDs, that's probably reason it looked like a new solution
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