Reputation: 1952
I am trying to filter out the prices with a nested foreach
and if statement in smarty, but whenever i use if statement inside foreach
loop it results in blank page.
Here is code causing issue
{foreach $value.Regstration as $price}
{if($price.price gt 0)}
<br>{var_dump($price.price)} <br>
{/if}
{/foreach}
Even i tried with this
{foreach $value.Regstration as $price}
{if(1==1)}
<br>{var_dump($price.price)} <br>
{/if}
{/foreach}
This is also returning blank page
But without if statement i am getting result like this
float(14.95)
float(-1)
float(-1)
float(-1)
So can anyone tell me where i am doing wrong or if not can anyone tell me how can i filter the prices equal to or lower then zero.
Upvotes: 0
Views: 51
Reputation: 51
Try this:
{foreach $value.Regstration as $price}
{if 1 == 1}
<!--
For debug:
{$price|var_dump}
-->
<br>{$price.price|var_dump}<br>
{/if}
{/foreach}
Upvotes: 0