我是smarty的新手,我希望显示包含qualify
的所有数组我有一个循环
select *
from the_table
qualify min(column_3) over (partition by column_1) = column_3;
'sezoniere' => null
这是数组:
{foreach from=$servList item=_item name=servList}
循环中的第二个数组:
<h6><a href="{$baseURL}{if !$smarty.foreach.servList.first}{$_item.post_name}{else}servicii{/if}/" title="{$_item.nume}">{$_item.nume}</a></h6>
{/foreach}
我如何才能在循环中仅显示具有'id' => string '1' (length=1)
'nume' => string 'Serviciul 1' (length=11)
'post_name' => string 'serviciul-1' (length=11)
'sezoniere' => string '1' (length=1)
?
答案 0 :(得分:0)
也许只需添加if statemant
{foreach $servList a $item}
{if !$item.sezoniere}
your code here
{/if}
{/foreach}
但更好的解决方案是在PHP中定义2个数组并声明为smarty。
答案 1 :(得分:0)
问题的解决方案是:
{foreach from=$servList item=_item name=servList}
{if !$_item.sezoniere}{* do nothing *}{else}
<h6 class="orange">{$_item.nume}</h6>
<p class="p0">{$_item.descriere|truncate:300}</p>
<a class="link-1" href="{$baseURL}{if $_item@first}servicii{else}{$_item.post_name}{/if}/" title="{$_item.nume}">Read more</a>
{/if}
{/foreach}