Skip to content

Stray {foreachelse} tag #1101

Open
Open

Description

@NoNoNo

A {foreachelse} tag is being mentioned in

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

docs/latte/en/tags.texy

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions