← Back to team overview

phpdevshell team mailing list archive

[Bug 689998] [NEW] Smarty foreachelse not working

 

Public bug reported:

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!

** Affects: phpdevshell
     Importance: Undecided
         Status: New

-- 
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!





Follow ups

References