Jump to content

JerryDi

Members
  • Posts

    40
  • Joined

  • Last visited

Posts posted by JerryDi

  1. 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>";

    }
    ?>

  2. 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

     

  3. 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

  4. 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

  5. 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

     

  6. 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

    • Like 2
×
×
  • Create New...