I have an array that I need to loop through, and for specific keys, I then need to call chopActNum function. The function takes an account number, and turns it into the "xxxxxxxxxx1234" format. I would like to then display this new format rather than the whole account number. My $accountList
holds all the information for the accounts. My confusion is in that I currently display all my account information through assignment in Smarty templating. I am horrible at explaining, so perhaps seeing my code will help elucidate my issue.
My function:
public function chopActNum($actNum=0){
$numPlace=strlen($actNum)-4;
$repeatX=str_repeat('x',$numPlace);
$actNumConcat=$repeatX.substr($actNum, -4);
return $actNumConcat;
Php:
foreach($achList as $a)
{
$actNum[] = $a['actNum'];
$chopNum=$Ach->chopActNum($actNum);
}
$achList=$Ach->listAch($logged_userid);
$smarty->assign("accountList",$achList);
Tpl Code:
{foreach from=$accountList item=v name=foo}
<td class="tableData">{$v.actName}</td>
<td class="tableData">{$v.actNum}</td>
<td class="tableData">{$v.bankRoute}</td>
{/foreach}