0
我有一個名爲listing的數組。我如何獲得多個計數器。在下面給出的例子中,我得到的條件是一個數字。我需要一個計數器來獲取條件爲0的數字。我想要使用相同的foreach循環的結果,並且不想創建新的foreach循環。Smarty模板中的多個計數器
{counter start=1 print=0}
{foreach from=$listings item=listing}
{if $listing.condition == '1'}
{counter print=0}
{/if}
{/foreach}
{counter} // This givens me total count where condition is 1.
這工作。謝謝。 – 2015-03-02 05:09:31