Hi All
Newbie question.
I'm trying to add a total of the $scores in a scoreboard at the bottom of the table.
Can anyone help please ?
This is what i have so far
function leaderboard()
{
$scores = get_scores();
$num_scores = count( $scores );
usort( $scores, 'cmp_scores' );
$HTML = '<table id="entries">' . "\n";
$HTML .= '<thead>' . "\n";
$HTML .= '<tr>' . "\n";
$HTML .= ' <th>BDM</th>' . "\n";
$HTML .= ' <th>Attendees</th>' . "\n";
$HTML .= '</tr>' . "\n";
$HTML .= '</thead>' . "\n";
$HTML .= '<tbody>' . "\n";
for ( $i = 0; $i < $num_scores; $i++ )
{
$HTML .= '<tr>' . "\n";
$HTML .= ' <td class="player">' . str_format( $scores[$i]['name'] ) . '</td>' . "\n";
$HTML .= ' <td class="player">' . $scores[$i]['points'] . '</td>' . "\n";
$HTML .= '</tr>' . "\n";
}
$HTML .= '</tbody>' . "\n";
$HTML .= '<tfoot>' . "\n";
$HTML .= '<tr>' . "\n";
$HTML .= ' <th colspan="2"></th>' . "\n";
$HTML .= '</tr>' . "\n";
$HTML .= '</tfoot>' . "\n";
$HTML .= '</table>' . "\n";
return $HTML;
Everything functions beautifully - apart from the total I need to show in the 'tfoot' section.
Thanks in advance