Php Smarty-用数组填充表格
在我的PHP类中,我发送了一些数组,对于客户在表中有一行的每个合同,都应该填写。 我的约会对象有一些错误: 在第70行“{$date[$id]| date_格式:%d%m%Y}”-意外“|” 其他数组也有一些错误Php Smarty-用数组填充表格,php,html,arrays,html-table,smarty,Php,Html,Arrays,Html Table,Smarty,在我的PHP类中,我发送了一些数组,对于客户在表中有一行的每个合同,都应该填写。 我的约会对象有一些错误: 在第70行“{$date[$id]| date_格式:%d%m%Y}”-意外“|” 其他数组也有一些错误 <table class="table table-hover"> <thead> <tr> <td>ID</td>
<table class="table table-hover">
<thead>
<tr>
<td>ID</td>
<td>Datum</td>
<td>Preis</td>
<td>Verbrauch</td>
<td>Abnahmestellen</td>
<td>Status</td>
</tr>
</thead>
<tbody>
{foreach from=$contractCount item=item key=key}
<tr>
<td>
<a href="{System::getLink('contractView')}"><input type="button" style="text-align: center" width="200em" value="Gehe zu "></a>{$id+1}
</td>
<td>
{$date[$id] | date_format: %d %m %Y}
</td>
<td>
{$KWhRate[$id]}
</td>
<td>
{$totalUsage[$id]}
</td>
<td>
{$consumptionsPoints[$id]}
</td>
<td>
{if $status[$id] == 0}
<span {literal}style="background-color:#ff9933"{/literal}>In Bearbeitung</span>
{/if}
{if $item->status[$id] == 1}
<span {literal}style="background-color:#ff0000"{/literal}>Abgeschlossen</span>
{/if}
{if $item->status[$id] == 2}
<span {literal}style="background-color:#33cc33"{/literal}>Stoniert</span>
{/if}
</td>
</tr>
{/foreach}
</tbody>
</table>
身份证件
资料
普赖斯
长篇大论
艾布纳梅斯特伦
地位
{foreach from=$contractCount item=item key=key}
{$id+1}
{$date[$id]| date_格式:%d%m%Y}
{$Kwrate[$id]}
{$totalUsage[$id]}
{$consumptionsPoints[$id]}
{如果$status[$id]==0}
在北洞
{/if}
{如果$item->status[$id]==1}
阿伯格施洛森
{/if}
{如果$item->status[$id]==2}
斯托尼埃
{/if}
{/foreach}
如何设置$id
变量?从控制器还是通过smarty?还有其他错误吗?$id=0。。。在php代码中,它表示不允许使用数组。错误短语是什么?不能将data\OfferResult类型的对象用作中的数组