Apply an empty string between two blocks of different dates

I'm trying to come up with something in my wordpress theme (soccer club, from Themeboy).

For example on this page: Link example

You see a list of a number of matches in blocks of 4 for each game date.

03/09/2017  K. Lierse SK D      10:00   Heikant Berlaar
03/09/2017  K. FC Pulle B       10:00   K. RAC. Emblem B
03/09/2017  K. Bevel FC A       10:00   K. Ramsel FC 
03/09/2017  SK Rita Berlaar A   10:00   Kessel United
10/09/2017  K. FC Pulle B       10:00   SK Rita Berlaar A 
10/09/2017  Kessel United       11:00   K. Bevel FC A
10/09/2017  K. RAC. Emblem B    11:15   Heikant Berlaar
10/09/2017  K. Ramsel FC        11:30   K. Lierse SK D K
17/09/2017  SK Rita Berlaar A   10:00   K. RAC. Emblem B
17/09/2017  Heikant Berlaar     10:00   K. Ramsel FC 
17/09/2017  K. Bevel FC A       10:00   K. FC Pulle B
17/09/2017  K. Lierse SK D      11:45   Kessel United

      

What I would like to do is apply an empty string every time the play date changes, so it looks like this.

03/09/2017  K. Lierse SK D      10:00   Heikant Berlaar
03/09/2017  K. FC Pulle B       10:00   K. RAC. Emblem B
03/09/2017  K. Bevel FC A       10:00   K. Ramsel FC 
03/09/2017  SK Rita Berlaar A   10:00   Kessel United
(Empty row)
10/09/2017  K. FC Pulle B       10:00   SK Rita Berlaar A 
10/09/2017  Kessel United       11:00   K. Bevel FC A
10/09/2017  K. RAC. Emblem B    11:15   Heikant Berlaar
10/09/2017  K. Ramsel FC        11:30   K. Lierse SK D K
(Empty row)
17/09/2017  SK Rita Berlaar A   10:00   K. RAC. Emblem B
17/09/2017  Heikant Berlaar     10:00   K. Ramsel FC 
17/09/2017  K. Bevel FC A       10:00   K. FC Pulle B
17/09/2017  K. Lierse SK D      11:45   Kessel United

      

I'm not too familiar with PHP to figure it out completely on my own, but I think with some help I can figure it out.

Here is a paste with the full source code of the page. The list is created using a file event-list.php

.

As far as I know, I will probably have to store the date in a variable and then compare it with the date of the previous echo line. And if not the same, add a blank line somehow.

+3


source to share


1 answer


in your loop where u print all lines use live below



$tmpdate = "";

for(loop){
    if($tmpdate != $looprecorddate){
        echo '<tr></tr>';
        $tmpdate = $looprecorddate;
    }
    // your code for print rows here 
}

      

+2


source







All Articles