da² Posted August 6 Share Posted August 6 (edited) Hi, I think of refactoring several pages into a repeater, but I need to be able to load a single repeater item by specifying the parent page... and I'm struggling. Here the actual code: $pages->find("template=repeater_leaderboardCategories, carsOrCarClasses=5941, include=all"); The result: ProcessWire\PageArray Object ( [count] => 2 [items] => Array ( [LeaderboardCategoriesRepeaterPage:0] => Array ( [id] => 6065 [name] => 1722945441-3239-1 [parent] => /cockpit/repeaters/for-field-277/for-page-6057/ [template] => repeater_leaderboardCategories [title] => Array ( [data] => cat2 [data5865] => ) ) [LeaderboardCategoriesRepeaterPage:1] => Array ( [id] => 6070 [name] => 1722946036-4849-1 [parent] => /cockpit/repeaters/for-field-277/for-page-6066/ [template] => repeater_leaderboardCategories [title] => Array ( [data] => champ 2 2 [data5865] => ) ) ) [selectors] => template=repeater_leaderboardCategories, carsOrCarClasses=5941, include=all ) I get two repeater items, but coming from 2 different pages. So I want to specify the parent page of the repeater (id=6057), but none of my tests have worked. I've tried a lot of things like this: $pages->find("template=repeater_leaderboardCategories, carsOrCarClasses=5941, include=all, parent.getForPage=6057"); I also tried to search from the parent page directly: $page = $pages->get(6057); $page->leaderboardCategories('carsOrCarClasses=5941'); This works with a ProFields Table, but the repeater loads all items. Any suggestion? Edited August 6 by da² Link to comment Share on other sites More sharing options...
Jan Romero Posted August 6 Share Posted August 6 (edited) Would this help? https://processwire.com/blog/posts/processwire-3.0.95-core-updates/ I guess it would be something like this, but I’m on mobile, so untested: $pages->find("template=repeater_leaderboardCategories, carsOrCarClasses=5941, include=all, leaderboardCategories.owner.id=6057"); Edited August 6 by Jan Romero Link to comment Share on other sites More sharing options...
da² Posted August 6 Author Share Posted August 6 (edited) Nope. ? Quote Fatal error: Uncaught ProcessWire\PageFinderSyntaxException: Field does not exist: owner Edited August 6 by da² Link to comment Share on other sites More sharing options...
Jan Romero Posted August 6 Share Posted August 6 (edited) Sorry, I told you I was just guessing 😅 It should work using the updated code above. Apparently "owner" needs to be prefixed by the name of the repeater field. This time I have tested it. Edited September 26 by Jan Romero 1 Link to comment Share on other sites More sharing options...
da² Posted August 6 Author Share Posted August 6 (edited) Yes this is working, I don't really understand how because the field leaderboardCategories is not used in the rest of the selector... but that works. ? Edited August 6 by da² 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