Asking for adjustment of soccer script code

php

#1

I have soccer page and i need adjustment for the following code
I tried many time but unfortunately i failed to make it

  • Modefied code

<?php
    // Show the score unless the game has not been played yet 
               
         print '<font color="#800000">';
         if ($scores['winortie'] != 3) { print $scores['rf'] . ' : ' . $scores['ra']; 
        if ($scores['ef'] != 0 && $scores['ea']!= 0)                                 {
        print '<b><font size="3"><font color=red > (Fulltime)';     
         }
         
        if ($scores['winortie'] == 2 || $scores['winortie'] == 5)                     {
        print '<b><font size="3"><font color="black"> (Forfiet)';
        }
     
        print '<br><font color="#000080">';
        if ($scores['ef'] != 0 && $scores['ea']!= 0) { print $scores['ef'] . ' : ' . $scores['ea'];    {
        print '<b><font size="3"><font color=#800080" > (Extra time)';
        }

          print '<br><font color="#008000">';
          if (($scores['ef'] == $scores['ea']) && ($scores['pf'] != 0 && $scores['pa']!= 0))  { print $scores['pf'] . ' : ' . $scores['pa'];  {
         print '<b><font size="3"><font color=blue > (Penalty)';
                 }

           print '<br><font color="#008000">';
         if (($scores['rf'] == $scores['ra']) && ($scores['pf'] && $scores['pa']!= 0)  && ! ($scores['ef']  && $scores['ea'])) { print $scores['pf'] . ' : ' . $scores['pa'];  {
         print '<b><font size="3"><font color=red > (Penalty)';
        }
        }
      }
    }
    print '</td>';
}


  • the original code :
<?php } ?>
        <td><?php print $scores['rf'] . ' - ' . $scores['ra'];
    if ($scores['winortie'] == 2 || $scores['winortie'] == 5) {
        print ' (ff)';
    }
    print '</td>';
?>

some abbreviations before start my inqury:

rf = Runs for
ra = Runs against

ef = Extra time for
ea = Extra time against

pf = penalty for
pa = penalty against

$scores[‘winortie’] = 3 mean play
$scores[‘winortie’] == 2 mean Beat (by forfeit)
$scores[‘winortie’] == 5 mean Lost to (by forfeit)
$scores[‘winortie’] == 0 mean ties

print $scores[‘rf’] . ’ : ’ . $scores[‘ra’]; ====> for main time

print $scores[‘ef’] . ’ : ’ . $scores[‘ea’]; ===> for extra time

{ print $scores[‘pf’] . ’ : ’ . $scores[‘pa’]; =====> for penalty

as you know in cup soccer matches
– games ended in fulltime

  • games ended after extra time

  • games go after extra time to penalty

  • some matched when did not ended in fulltime go directly to penalty without extratime

  • my request to modify the code as
    – if the game ended in full time - I will get the result of full time result ( without mention full time word)

  • if the game ended after extra time - I will get the result of game ( both full time and extra time ) with mention that the game has extra time , I do not need to mention full time as well

  • if the game goes after extra time to penalty : I will get the (full time result + Extra time result + penalty result ) and mention that the game has extra time and penalty

  • if the game when did not ended in fulltime and went directly to penalty kick without extratime : i will get (full time result + penalty result) and mention only penalty word

from my modified code (which I used some information from this page) :

  • I got the result of games that ended in the full time ( without extra time or penalty)
    and also the games that ended by Beat (by forfeit) or Lost to (by forfeit) and I also got ==> print ’ (forfeit)’;
    this part of code is ok

  • if the game ended in extra time : i got the full time result , extra time result and print ’ (Extra time)’;
    which is ok

  • if the game did not ended after extra time and extended to penalty kick
    I got the full time result + Extra time result + penalty result (+) (print extra result & print penalty) in front of each result
    which is ok as well

but if the games not ended in the full time ( for example ties by any result ) and the match went directly to penalty without extra time
the code display the full time and does not showed the penalty result and showing print ’ (penalty)’;
I want any way to adjust the last part or even the whole code to give me what I want

is there any idea how can correct the code,



#2

Daisy chaining. Review this logic.


#3

this the original code before i modified it
ff mean forfeit


#4

There are very sensitive components to this code.

<?php } ?>

closes a PHP code block.

One would never create an element and then close it dynamically. Better to create the whole thing dynamically. That’s what I mean by “daisy chaining”.


#5

@mtf
Thank you for you replay
i am just Amateur , I did all changes in this script without any php knowledge .
I just followed what i find in internet!
I do not know how you can help me in this portion of script


#6

when I edited } ?> i got white page


#7

It was not suggested to remove that code as it is a very important part of the preprocessor code.

<?php 
    if (something ) {
 ?>
    <td>some content</td>
    <td>some content</td>
    <td>some content</td>
<?php } ?>

Notice how the last PHP tag closes the code block of the PHP if? The code between is raw HTML that will only render when something is true.

As for what the problem is in your OP we cannot say without seeing the complete document.


#8

@mtf

Thank you , I will follow your advice


#9

Thank you
I fixed the code
thank you for Mr. mtf for his advice
@mtf


#10

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.