<!--{if $invoice_list}-->
<div id="OutSearch_Title">发货查询</div>
<div class="OutSearch_Content">
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<!-- {if $invoice_list eq ""} -->
<tr>
<td>目前没有发货查询单!</td>
</tr>
<!-- {else} -->
<!-- 发货单查询{foreach from=$invoice_list item=invoice} -->
<tr align="left">
<th width="30%" style="font-size:12px; color:#ffb70a; font-family:Arial, Helvetica, sans-serif; font-weight:100; margin-left:5px"> {$lang.order_number}</th>
<td style="font-size:11px; margin-left:5px;color:#ffb70a;"> {$invoice.order_sn}</td>
<td style="font-size:11px; margin-left:5px;color:#ffb70a;"> {$temp}</td>
</tr>
<tr align="left">
<th width="30%" style="font-size:12px; color:#ffb70a; font-family:Arial, Helvetica, sans-serif; font-weight:100; margin-left:5px"> {$lang.consignment}</th>
<td style="font-size:11px;border-bottom:0px dashed #DADADA; margin-left:5px;color:#ffb70a;"> {$invoice.invoice_no}</td>
</tr>
<!-- 结束发货单查询{/foreach}-->
<!-- {/if} -->
</table>
<div style="width:50px; float:right; margin-top:10px; margin-left:15px; ">
<a href="More_Order.php" target="_blank"><img src="../images/btnMore.gif" border="0" /></a>
</div>
</div>
<!-- {/if} -->
红色部分是添加的代码。为什么不执行?请教,是否写错了?
<div id="OutSearch_Title">发货查询</div>
<div class="OutSearch_Content">
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<!-- {if $invoice_list eq ""} -->
<tr>
<td>目前没有发货查询单!</td>
</tr>
<!-- {else} -->
<!-- 发货单查询{foreach from=$invoice_list item=invoice} -->
<tr align="left">
<th width="30%" style="font-size:12px; color:#ffb70a; font-family:Arial, Helvetica, sans-serif; font-weight:100; margin-left:5px"> {$lang.order_number}</th>
<td style="font-size:11px; margin-left:5px;color:#ffb70a;"> {$invoice.order_sn}</td>
<td style="font-size:11px; margin-left:5px;color:#ffb70a;"> {$temp}</td>
</tr>
<tr align="left">
<th width="30%" style="font-size:12px; color:#ffb70a; font-family:Arial, Helvetica, sans-serif; font-weight:100; margin-left:5px"> {$lang.consignment}</th>
<td style="font-size:11px;border-bottom:0px dashed #DADADA; margin-left:5px;color:#ffb70a;"> {$invoice.invoice_no}</td>
</tr>
<!-- 结束发货单查询{/foreach}-->
<!-- {/if} -->
</table>
<div style="width:50px; float:right; margin-top:10px; margin-left:15px; ">
<a href="More_Order.php" target="_blank"><img src="../images/btnMore.gif" border="0" /></a>
</div>
</div>
<!-- {/if} -->
红色部分是添加的代码。为什么不执行?请教,是否写错了?
<!-- 发货单查询{foreach from=$invoice_list item=invoice} -->
<tr align="left">
<th width="30%" style="font-size:12px; color:#ffb70a; font-family:Arial, Helvetica, sans-serif; font-weight:100; margin-left:5px"> {$lang.order_number} </th>
<td style="font-size:11px; margin-left:5px;color:#ffb70a;"> {$invoice.order_sn} </td>
<td style="font-size:11px; margin-left:5px;color:#ffb70a;"> {$temp} </td>
</tr>
<tr align="left">
<th width="30%" style="font-size:12px; color:#ffb70a; font-family:Arial, Helvetica, sans-serif; font-weight:100; margin-left:5px"> {$lang.consignment} </th>
<td style="font-size:11px;border-bottom:0px dashed #DADADA; margin-left:5px;color:#ffb70a;"> {$invoice.invoice_no} </td>
</tr>
{foreachelse}
<tr>
<td>目前没有发货查询单! </td>
</tr>
<!-- 结束发货单查询{/foreach}--> 你的smarty tag是{}那么 建议你把<!-- --> 去掉,加他们会出错的。。
<!--{if $invoice_list eq ""}-->
<tr>
<td>目前没有发货查询单! </td>
</tr>
<!--{else}-->
<!--{foreach from=$invoice_list item=invoice}-->
<tr align="left">
<th width="30%" style="font-size:12px; color:#ffb70a; font-family:Arial, Helvetica, sans-serif; font-weight:100; margin-left:5px"> {$lang.order_number} </th>
<td style="font-size:11px; margin-left:5px;color:#ffb70a;"> {$invoice.order_sn} </td>
<td style="font-size:11px; margin-left:5px;color:#ffb70a;"> {$temp} </td>
</tr>
<tr align="left">
<th width="30%" style="font-size:12px; color:#ffb70a; font-family:Arial, Helvetica, sans-serif; font-weight:100; margin-left:5px"> {$lang.consignment} </th>
<td style="font-size:11px;border-bottom:0px dashed #DADADA; margin-left:5px;color:#ffb70a;"> {$invoice.invoice_no} </td>
</tr>
<!--{/foreach}-->
<!--{/if}-->
phpcms好像可以这样的:
<!-- {if $invoice_list==null} --> 这个问题最主要的还是要看你的这个数组。
有可能是一个空数组,那就该判断成
<!-- {if sizeof($invoice_list)==0} -->