Re: [SMARTY] Weird problem with if-else
| From: | A.J. Brown | Date: | Tue, 27 Sep 2005 12:54:56 +0000 |
| Subject: | Re: [SMARTY] Weird problem with if-else | ||
| References: | 1 2 3 4 5 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-13065@lists.php.net to get a copy of this message | ||
Problem Solved!
This is most definitely a bug IMHO. Since my work-around to the problem works, Smarty obviously recognizes the difference in value of true and false without the surrouning quotes. Removing the quotes does not appear to modify the comparison, other than to cause the "unexpected {else}" error.
Thanks for all of your help!
Sincerely,
A.J. Brown
BitNotion Technologies
aj@bitontion.com
----- Original Message ----- From: "pbaker" <baker_net@tlen.pl>
To: "A.J. Brown" <aj@bitnotion.com>
Sent: Tuesday, September 27, 2005 7:09 AM
Subject: Re: [SMARTY] Weird problem with if-else
{foreach from=$calendar.weeks item="week"} <tr class="calendar_week"> {foreach from=$week item="day"} {if $day.blank eq true}<td> </td>{else}{include file="calendar_cell_bit.tpl"}{/if} {/foreach} </tr> {/foreach}At first I thought the problem was with the included file, but I still get the error even if I comment out that line. There are no other {if} statements anywhere else in this template, so I'm positive it's not a nesting or unclosed {if} problem.When I use the following code instead, it works perfectly:{foreach from=$calendar.weeks item="week"} <tr class="calendar_week"> {foreach from=$week item="day"} {if $day.blank eq true}<td> </td>{/if} {if $day.blank eq false}{include file="calendar_cell_bit.tpl"}{/if} {/foreach} </tr> {/foreach}What's up with this?Hi, the error (i think ;) is in line{if $day.blank eq true}try this:{if $day.blank eq "true"}it always works for me :P