我已将此代码添加到Smarty模板文件中:
$totalearnings = {$pendingcommissions|replace:' USD':''|replace:'$':''} + {$balance|replace:' USD':''|replace:'$':''} + {$withdrawn|replace:' USD':''|replace:'$':''};
echo $totalearnings;
这就是它在页面上的显示方式:
$totalearnings = 0.00 + 1010.00 + 2000.00;
echo $totalearnings;
我需要更改以使此代码正常工作? $totalearnings
应该添加数字,而不是仅仅在页面上显示等式...
答案 0 :(得分:0)
使用{assign var="name" value="Bob"}
{assign var="p" value=$pendingcommissions|replace:' USD':''|replace:'$':'' }
{assign var="b" value=$balance|replace:' USD':''|replace:'$':'' }
{assign var="w" value=$withdrawn|replace:' USD':''|replace:'$':'' }
{assign var="totalearnings" value=0}
{assign var="totalearnings" value=$totalearnings+$p+$b+$w}
{$totalearnings}