JerryDi
-
Posts
40 -
Joined
-
Last visited
Posts posted by JerryDi
-
-
Unfortunately using name does not work
Is the issue here that this string is trying to select from a different template than the primary find?
-
as per previous post, when I add ->title as per your post above, the page ID then disappears and I get just this:
County Championship 1995
A bit baffling....
-
2 minutes ago, ngrmm said:
@JerryDi could you paste in here the latest version of your code.
<?php
$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}</a></li>";}
?> -
Hi, I have tried both of these options and a few others but none of them work
The two you have shown above do not return the page ID, but when I remove ->title, it does return the page ID [1442 being the ID]:
County Championship 1995 - 1442
Many thanks
J
-
thanks for this da2,
I had tried this but it produced this: County Championship 2023 - 1442->title
I have reverted to this: foreach($playerChampionships as $championship) {
echo "<li><a href='$championship->url'> $championship->title - {$championship->winner_name}</a></li>";
}
?>This produces County Championship 2023 - 1442
So it's getting the player page ID (1442) but not the title value. As a php newbie I am baffled.
Any further thoughts?
thanks
-
One further question if I may:
this works fine, but I now want to add winner_name [which is a PageRef field derived from the title field in a separate template, Players] to the string that is returned
I have tried this additional text [in bold as below], but it only returns the id number for the winner
How can I get it to return the title field from the Players template ie the full winner's name?
<?php
$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</a></li>";}
?>thanks
-
thank you for your patience with me!
Having now grasped this I am sure I can complete my project as it covers almost all of the functionality needed
J
-
2
-
-
thank you! This now produces the ID numbers for each championship. How would I change that to give the championship page titles as URLs?
-
thanks, I tried both of these but they both produce an error:
Error: Exception: Unrecognized operator: $ (in wire/core/Selectors.php line 416)
-
Thank you for your reply. This is what I have inserted into the template:
<p>Below you can follow links to this player's tournament wins </p>
<?php
$playerChampionships = $pages->find('template=championship_results, winner_name=§page->id');
foreach($playerChampionships as $championship) {
echo "$championship <br>";}
?>
It does not return any results, although the player I am testing it with has 20+ wins to his name. Have I done something wrong? Note..I am also a php novice!
thanks Jerry
-
Hi,
I am new to PW so please excuse me if this is a bit basic!
I have ~1000 golfer names using the player template. Other templates with results for various championships use the player name in a field called winner_name which is a Page Reference field linked to the player template title field.
When viewing the player page I want to show all related pages that use a specific template. Please can you advise me on the php syntax required?
Thanks
Jerry
-
Thanks @Zeka, this is very relevant!
-
1
-
-
Hi Ryan, thank you, that is very helpful. I have learned with other frameworks and CMSs that there are various ways to achieve an objective. Your suggestion makes sense, so I'll go with that. Jerry
-
I am new to ProcessWire and liking what I see.
Could I ask for a bit of guidance. I am building a web archive for my county golf association. We have 90+ clubs. Clubs have players who win championships and/or play for county teams, and the clubs host these events. We have around 12 championships a year with results going back over 100 years. My objective is to be able to select a club, championship or player and see related events / results for each.
My data is in csv files and I need to import this [already done the clubs, the import module works great].
My question is re structure and whether, for example, I need to have championship results as a child of the championship main page or whether it would be simpler to create queries to get the data I need. Any guidance much appreciated. Jerry-
2
-
Select pages using specific template
in General Support
Posted
Here they are...the player screen grab only shows part of the page
thank you