phpdevshell team mailing list archive
-
phpdevshell team
-
Mailing list archive
-
Message #00365
[Bug 689998] Re: Smarty foreachelse not working
This bug is INVALID ...
I posted question on Smarty forum and got this reply:
$RESULTS is not null or an empty array but has an assigned boolean value
of false. This does enter the loop and not the {foreachelse} section.
Values of FALSE and of "" (blank string) are NOT the same as being NULL
or EMPTY.
--
You received this bug notification because you are a member of
PHPDevShell, which is subscribed to PHPDevShell.
https://bugs.launchpad.net/bugs/689998
Title:
Smarty foreachelse not working
Status in Open Source PHP RAD Framework with UI.:
New
Bug description:
Here is a simple example of a problem I am having, where the variable sent to the smarty template is empty but the foreachelse does not seem to work.
So set $RESULTS=false; in controller and then call View.
Here is a sample template file:
{if ''==$RESULTS}
BLANK<br>
{/if}
{if false==$RESULTS}
FALSE1<br>
{/if}
{if false===$RESULTS}
FALSE2<br>
{/if}
{foreach $RESULTS as $result}
Result is {$result}<br>
{foreachelse}
Results are empty!
{/foreach}
Here are the ACTUAL results I am getting:
BLANK
FALSE1
FALSE2
Result is
Notice the IF statements are all confirming the value of $RESULTS is blank/empty, but the foreachelse is not being called.
The expected results should be this, but I can't figure out why it is not working:
BLANK
FALSE1
FALSE2
Results are empty!
References