Witaj,
@EarthCitizen - dziękuję Ci z góry za chęć pomocy, mimo to, dziwnie skrypt reaguje. Powinno się teoretycznie wyświetlić:
15.00 -
10.00 -> 5.00 - dla dodania
5.00 +
10.00 -> 15.00
A mi w każdym przypadku podaje końcową liczbę i kolor zielony. W czym może tkwić problem?
<?php
//-----------------------------------------
// Build query...
//-----------------------------------------
$this->ipsclass->DB->build_query( array ( 'select' => 'fg.*', 'from' => array( 'fg_logs' => 'fg' ), 'select' => 'mf.members_display_name AS from_name',
'from' => array( 'members' => 'mf' ), 'where' => 'mf.id = fg.id_from',
'type' => 'left' ),
'select' => 'mt.members_display_name AS to_name',
'from' => array( 'members' => 'mt' ), 'where' => 'mt.id = fg.id_to',
'type' => 'left' ) ),
'where' => 'id_from = '.$this->ipsclass->member['id'].' OR id_to = '.$this->ipsclass->member['id'],
'order' => 'date '.$order,
'limit' => array( $this->loop,$this->per_page ) ) );
$query = $this->ipsclass->DB->exec_query();
while ( $row = $this->ipsclass->DB->fetch_row($query) )
{
$row['amount'] = ( $this->ipsclass->input['uid'] ) ? '<span style="color: red;">' . ($row['fg_from'] + $row['amount']) . '</span>' : '<span style="color: green;">' . ($row['fg_to'] - $row['amount']) . '</span>';
$row['date'] = $this->ipsclass->get_date( $row['date'], 'SHORT' );
$this->output .= $this->ipsclass->compiled_templates['skin_fg']->fg_logs_row($row);
}
?>
Jak widzisz, a w skinie przekazuje zmienną $row['amount']. Masz jakieś sugestię?
PS. Kod, który przepisywałem pod siebie z nowymi funkcjami, odpowiadający za to, wygląda tak:
<?php
if($row['id_from'] == $this->ipsclass->member['id'])
$table .= $row['fg_from']." - <font color='red'>".$row['amount']."</font> -> ".number_format(($row['fg_from'] - $row['amount'])); else
$table .= $row['fg_to']." + <font color='green'>".$row['amount']."</font> -> ".number_format(($row['fg_to'] + $row['amount'])); ?>
PS2. Udało mi się samemu. Dziękuję za nakierowanie :-) Oto poprawny kod:
<?php
while ( $row = $this->ipsclass->DB->fetch_row($query) )
{
if ( $row['id_from'] == $this->ipsclass->member['id'] )
{
$row['amount'] = $row['fg_from'].' - <span style="color: red;">'.$row['amount'].'</span> -> '.($row['fg_from'] - $row['amount']);
}
else
{
$row['amount'] = $row['fg_to'].' - <span style="color: green;">'.$row['amount'].'</span> -> '.($row['fg_to'] + $row['amount']);
}
$row['date'] = $this->ipsclass->get_date( $row['date'], 'SHORT' );
$this->output .= $this->ipsclass->compiled_templates['skin_fg']->fg_logs_row($row);
?>
Pozdrawiam,
Largo