0
{* products_list.tpl *}
{load_presentation_object filename="products_list" assign="obj"}
{if $obj->mProducts}
<table class="product-list" border="0">
<tbody>
{section name=k loop=$obj->mProducts}
{if $smarty.section.k.index % 2 == 0}
<tr>
{/if}
<td valign="top">
<h3 class="product-title">
<a href="{$obj->mProducts[k].link_to_product}">
{$obj->mProducts[k].name}
</a>
</h3>
<p>
{if $obj->mProducts[k].thumbnail neq ""}
<a href="{$obj->mProducts[k].link_to_product}">
<img src="{$obj->mProducts[k].thumbnail}"
alt="{$obj->mProducts[k].name}" />
</a>
{/if}
{$obj->mProducts[k].description}
</p>
<p class="section">
Price:
{if $obj->mProducts[k].discounted_price != 0}
<span class="old-price">{$obj->mProducts[k].price}</span>
<span class="price">{$obj->mProducts[k].discounted_price}</span>
{else}
<span class="price">{$obj->mProducts[k].price}</span>
{/if}
</p>
</td>
{if $smarty.section.k.index % 2 != 0 && !$smarty.section.k.first ||
$smarty.section.k.last}
</tr>
{/if}
{/section}
</tbody>
</table>
{/if}
給出一個代碼我不清楚有以下行
{if $smarty.section.k.index % 2 == 0}
爲什麼上面的語句寫的,看看指數是偶數還是奇數,這對桌面顯示有什麼影響?
那麼到底什麼'{如果$ smarty.section.k.index%2 = 0 && $ smarty.section.k.first | | $ smarty.section.k.last}'行在那裏結束{/ tr} –
更新的答案,應該更清楚。 –
我得到下面的輸出一個水平線'0contents1contents2contents3contents4contents5contents6contents7contents8contents9conconnts10contents' –