In this web script, that I'm trying to modify, it has this section of php code:

$withdrawal_history = "";
if ($pt->setting_page == 'withdrawals') {
    $user_withdrawals  = $db->where('user_id',$pt->user->id)->get(T_WITHDRAWAL_REQUESTS);  
    foreach ($user_withdrawals as $withdrawal) {
        $pt->withdrawal_stat = $withdrawal->status;
        $withdrawal_history .= PT_LoadPage("settings/includes/withdrawals-list",array(
            'W_ID' => $withdrawal->id,
            'W_REQUESTED' => date('Y-F-d',$withdrawal->requested),
            'W_AMOUNT' => number_format($withdrawal->amount, 2),
            'W_CURRENCY' => $withdrawal->currency,
        ));
    }
}

I know that T_WITHDRAWAL_REQUESTS is the withdrawal_requests db table. So, does this chunk of code appear to take the withdrawal request amount from the table and load it into the page that displays the withdrawal requests history?

If not, what is this code doing? If so, is it possible to modify this code here to change the amount displayed? Such as displaying half of the amount (that is populated in the withdrawal history table's amount column) into the page that displays the withdrawal requests history ?

    It goes through a bunch of user_withdrawals and makes a big string by calling PT_LoadPage using a bunch of details from each one and concatenating the results together.

    Beyond that, it's your job to understand why it does any of that.

    I'm going to guess that W_AMOUNT could (in that it's physically possible) be altered to contain something different from what it currently contains. But if this is display-level logic (which is what it looks like, with names like "LoadPage" and "number_format") then chucking in business logic here (like, "halve this value for whatever madcap reason") would be a bad idea.

      I don't know which framework this is, but to add to Weedpacket's response - my guess is that settings/includes/withdrawls-list is a template partial. I'd bet it's a row designed to be used within a table and uses the W_* variables in display. Given that, this could be controller code and though I agree with Weedpacket about not jamming business logic into display-level functionality, if the display is actually a separate file I personally would feel ok making the change here. So perhaps this:

              $withdrawal_history .= PT_LoadPage("settings/includes/withdrawals-list",array(
                  'W_ID' => $withdrawal->id,
                  'W_REQUESTED' => date('Y-F-d',$withdrawal->requested),
                  'W_AMOUNT' => number_format( ($withdrawal->amount / 2), 2),
                  'W_CURRENCY' => $withdrawal->currency,
              ));
      Write a Reply...