Repository navigation
Open
Description
A {foreachelse} tag is being mentioned in
docs/latte/en/cookbook/grouping.texy
Line 199 in 01ac164
| What's the benefit of using `{iterateWhile}` like this? Because the `<ul>` is inside the outer `{foreach}`, nothing is rendered at all when the input is empty - no lone `<ul></ul>`. Without `{iterateWhile}` you would have to handle the same case with an `{if}` before opening the tag or via `{foreachelse}`. |
This tag is not being mentioned in
Lines 417 to 430 in 01ac164
| `{else}` .{toc: foreach-else} | |
| ----------------------------- | |
| Inside the `foreach` loop, you can specify an `{else}` clause, whose content is displayed if the loop is empty: | |
| ```latte | |
| <ul> | |
| {foreach $people as $person} | |
| <li>{$person->name}</li> | |
| {else} | |
| <li><em>Sorry, there are no users in this list</em></li> | |
| {/foreach} | |
| </ul> | |
| ``` |
My take is, that {foreachelse} does not exist in Latte 3.
Metadata
Metadata
Assignees
Labels
No labels
Activity