Jump to content

JerryDi

Members
  • Posts

    40
  • Joined

  • Last visited

Posts posted by JerryDi

  1. I need to move my site to a new server and have installed Duplicator

    However, when I Refresh modules I get error message as below meaning I can't access Duplicator. Any advice welcome

    Parse Error: syntax error, unexpected '''' (T_CONSTANT_ENCAPSED_STRING) (line 486 of /site/modules/Media Lister/ProcessMediaLister.module)

     

  2. I would appreciate some guidance on how to manage images.
    My project is a county golf archive. It has (currently) around 1000 player records, 500 championship records, 1000 match records.
    I have about 2,200 images, and this will increase by at least 200 per year. These images might be of a single player, so these are relevant to that player's page and maybe also a championship page or match he/she was playing in. But I also have many images that include multiple players eg team photo, relevant to multiple players and a match or championship.
    I would like pages for players, championships and matches to show related images for that player.
    What would be the best way to structure this? I have considered creating a separate template for all images utilising page reference fields to link to players, championships etc, but I don't know if this would impose a heavy overhead on the database and impact performance as the archive grows. Or should I simply have image fields in players, matches, championships templates, and put tag data into image fields to create the links?
    Many thanks

    Jerry


     

  3. I've used your syntax but it's produced error messages again:

    Notice: Undefined variable: countymatch in /home/w5j4zigjq498/public_html/processwire/site/templates/year-summary.php on line 176

    Warning: Invalid argument supplied for foreach() in /home/w5j4zigjq498/public_html/processwire/site/templates/year-summary.php on line 176

    line 176 is:

    <?php foreach($countymatch as $match): ?> 

     

  4. 5 hours ago, ColtNikolaus said:

    Replying for the updates.

    This is my code that attempts to output results to a table:

    <table border=1> 
    <thead>   
    <tr> 
    	<th>Opponents</th> 
            <th>Venue</th> 
    	<th>Points for</th> 
    	<th>Points against</th> 
            <th>Result</th> 
     
    </tr>
    </thead>
    
    <?php 
    
    $countymatch = $pages->find("template=county-match-result, year={$page->title} ");
    
    ?>
    
    <tbody>
    
    <tr>
    <?php
    foreach($countymatch as $match)  ?>
     
    
    <td><?php echo "<a href='$match->url'> {$match->title}</a>"; ?></td> 
    
    <td>
    <?php if ($match->home_away->title == 'Home'){
     echo $match->home_match_venue->title("<a href='{url}'>{title}</a>");
    } else{
    echo $match->away_match_venue;
    }; ?>
    </td>
     
                <td><?php echo $match->cheshire_points; ?></td> 
    	    <td><?php echo $match->opponent_points; ?></td> 
                <td><?php echo $match->match_result->title; ?></td> 
     </tr>      
      </tbody>
    </table> 

    and this is the code which I used to output to a list. This delivers all 11 matches perfectly, whereas I only get one with the table code

    <?php
    $countymatch = $pages->find("template=county-match-result, year={$page->title}");
    
    foreach($countymatch as $match) {
    	echo "<li><a href='$match->url'> $match->title</a></li>";
    }
    ?>

     

  5. Thank you for your replies.

    The Year field is not a page reference, it is a simple text field. I get the same result on any year I choose to look at ie just one row is returned.
    Changing the find to year=2023 produces the same result ie a single row. 
    If I use the same find and output the page titles to a list it works fine and delivers all the matches played in a given year.  So my logic tells me it must be something to do with the foreach loop, but I really don't know what the issue is. Any thoughts would be much appreciated

    Thanks again

    Jerry

  6. I've made some progress with this. It now renders one line but there should be 9 rows:

    Capture.JPG.e88c6ea4feed9681c259778f15a3fbab.JPG

    This is my code:

    <?php 
    
    $countymatch = $pages->find("template=county-match-result, year={$page->id} ");
    
    ?>
    
    <tbody>
    
    <tr>
    <?php
    foreach($countymatch as $match)  ?>
    
    <td><?php echo "<a href='$match->url'> $match->title -  {$match->title}</a>"; ?></td> 
    
    <td>
    <?php if ($match->home_away->title == 'Home'){
     echo $match->home_match_venue->title("<a href='{url}'>{title}</a>");
    } else{
    echo $match->away_match_venue;
    }; ?>
    </td>
                 <td><?php echo $match->cheshire_points; ?></td> 
    	    <td><?php echo $match->opponent_points; ?></td> 
                <td><?php echo $match->match_result->title; ?></td> 
    
     </tr>      
      </tbody>
    </table> 

    I've tried various other ways to do this with no success. I'd very much appreciate some direction. Thanks

  7. Thanks. I have checked and my table HTML is valid.
    So the remaining problem is the foreach loop. What I am doing is retrieving the page for matches played in the year. I then want to have rows displaying opponents, venue, points for, points against and result. All of these fields are in the same template. Could you give me some guidance on how to construct the correct loop?

    many thanks

    Jerry


     

     

  8. Hi,

    I am trying to present selected fields from a single template in a simple HTML table. Here is my code:

    <?php 
    
    $countymatch = $pages->find("template=county-match-result, year={$page->id}");
    
    ?> 
    
    <table> 
    <strong>    
    <tr> 
            <th>Opponents</th> 
            <th>Venue</th> 
    	<th>Points for</th> 
    	<th>Points against</th> 
            <th>Result</th> 
    </strong>    
    </tr> 
     
    <tr>
    <?php foreach($countymatch as $match): ?> 
    
    
    <td><?php echo "<a href='$match->url'> $match->title -  {$match->title}</a>"; ?></td> 
                <td><?php if ($match->home_away->title = 'Home'){
     echo $match->home_match_venue("<a href='{url}'>{title}</a>");
    } else{
    echo $match->away_match_venue;
    }; ?></td> 
                <td><?php echo $match->cheshire_points; ?></td> 
    	    <td><?php echo $match->opponent_points; ?></td> 
                <td><?php echo $match->match_result->title; ?></td> 
    
            </tr> 
        <?php endforeach; ?> 
    </table> 

    All I get when I run this is the header row. I know the contents of each column work as I've run these outside of a table. Any suggestions would be much appreciated

    Thanks

    Jerry

     

  9. 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"

    output1.JPG

×
×
  • Create New...