ngrmm Posted November 8, 2023 Share Posted November 8, 2023 What is the output for this: echo gettype($championship->winner_name); Link to comment Share on other sites More sharing options...
JerryDi Posted November 8, 2023 Author Share Posted November 8, 2023 Here they are...the player screen grab only shows part of the page thank you Link to comment Share on other sites More sharing options...
da² Posted November 8, 2023 Share Posted November 8, 2023 35 minutes ago, ngrmm said: What is the output for this: echo gettype($championship->winner_name); You should try this. ? And this: echo("<pre>" . print_r($championship->winner_name, true) . "</pre>"); exit(); And maybe show the configuration of the PageReference field. I have no idea what is going on. ? Link to comment Share on other sites More sharing options...
JerryDi Posted November 8, 2023 Author Share Posted November 8, 2023 Have tried this: echo("<pre>" . print_r($championship->winner_name, true) . "</pre>"); exit(); and the output is as attached When I tried this: echo gettype($championship->winner_name); I just got the word "object". So I tried echo gettype($championship->winner_name->title); and this produced "NULL" Link to comment Share on other sites More sharing options...
ngrmm Posted November 8, 2023 Share Posted November 8, 2023 @JerryDi you already tried this? 3 hours ago, ngrmm said: Then maybe winner_name is a multipagefield and you try this: $playerChampionships = $pages->find("template=Championship_results, winner_home_club={$page->id}"); foreach($playerChampionships as $championship) { echo "<li><a href='$championship->url'> $championship->title - {$championship->winner_name->first->title}</a></li>"; } Link to comment Share on other sites More sharing options...
da² Posted November 8, 2023 Share Posted November 8, 2023 6 minutes ago, ngrmm said: you already tried this? That's probably the issue. print_r output shows it's a PageArray, so we can't call PageArray->title. Instead of editing the code it's better to edit the PageReference configuration to set it to a single page and choose a single selection mode (a competition has only one winner): Link to comment Share on other sites More sharing options...
JerryDi Posted November 8, 2023 Author Share Posted November 8, 2023 yes!!! Thank you, this works now You've been v helpful, thanks so much ? 2 Link to comment Share on other sites More sharing options...
JerryDi Posted November 8, 2023 Author Share Posted November 8, 2023 Actually some competitions are for pairs, so multiple is required thanks Link to comment Share on other sites More sharing options...
ngrmm Posted November 8, 2023 Share Posted November 8, 2023 2 minutes ago, JerryDi said: Actually some competitions are for pairs, so multiple is required thanks Just FYI for those pages you would need to loop through $championship->winner_name. So you better loop always Link to comment Share on other sites More sharing options...
JerryDi Posted November 8, 2023 Author Share Posted November 8, 2023 ? 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