日期:2014-05-17 浏览次数:20438 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <body> <table width="500"> <tr bgcolor="#999999"><td width="34%">名称</td><td width="33%">价格</td><td width="33%">数量</td></tr> {foreach from=$carts key=k item=item0} {if $k % 2} <tr bgcolor="#FFFF66"> {else} <tr bgcolor="#66FFFF"> {/if} {foreach from=$item0 item=item1} <td>{$item1}</td> {/foreach} </tr> {assign var="sum" value="`$sum+$item0.price`"} {/foreach} <tr bgcolor="#999999"><td colspan="3" style="text-align:right">总金额:{$sum}</td></tr> </table> </body> </html>
------解决方案--------------------
如果要做乘法
{assign var="sum" value="`$sum+$item0.price*$item0.qty`"}