Forum Moderators: coopster

Message Too Old, No Replies

How to solve double IF sentences inside Smarty?

         

toplisek

6:35 pm on Jan 26, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have correct if:
{if}
{else}
{/if}


How to solve double IF: This is just example that there is main IF and inside this also IF-ELSE-IF
{if}

{if}
{else}
{/if}

{/if}

penders

7:52 pm on Jan 26, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



How to solve...


In what way "solve"? What happens exactly?

AFAIK Smarty supports nested IFs in the format you've given. However, there could be other syntax errors? Perhaps you could post your actual code?

toplisek

6:16 pm on Jan 27, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There is block element like
{if}
{else}
{/if}

This block should not be shown at website if it is FALSE {if}{/if}
{if}

{if}
{else}
{/if}

{/if}

Actually code is not needed. It is syntax issue.

penders

6:45 pm on Jan 27, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Actually code is not needed. It is syntax issue.


Have you resolved it? What was the "syntax issue"?

toplisek

1:05 pm on Jan 28, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Imagine you have code which demands IF sentences.
Thsi code should be shown only if there is TRUE setting. So, I like to publish code if I have true value. It seems to me only solution to add logical formula inside middle code.

In other words:
{if}

{if}
{else}
{/if}

{/if}

is not good but

{if value TRUE OR value == X }
{else}
{/if}