user7747472
user7747472

Reputation: 1952

Nested condition resulting empty page in smarty

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

Answers (1)

brzlvch
brzlvch

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

Related Questions