Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using {breakIf} in nested foreach loop #340

Closed
janda-quitec opened this issue Jun 29, 2023 · 1 comment
Closed

Error using {breakIf} in nested foreach loop #340

janda-quitec opened this issue Jun 29, 2023 · 1 comment

Comments

@janda-quitec
Copy link

janda-quitec commented Jun 29, 2023

Version: 3.0.6

Bug Description:
If {breakIf} is used, additional </span> is inserted into HTML code

Steps To Reproduce - paste this code to https://fiddle.nette.org/latte:

<span n:foreach="[0=>'a',1=>'b'] as $key=>$value">
{foreach ['a'=>'A','b'=>'B'] as $k=>$v}
{if $k == $value}
{$v}
{breakIf TRUE} {* chybu nadbytecneho </span> zpusobuje tento radek *}
{/if}
{/foreach}
</span>

@MartinStepar
Copy link

Persists in 3.0.9. As workaround (before fix) you can use outer {foreach} instead of n:foreach:

{foreach [0=>'a',1=>'b'] as $key=>$value} {* added outer foreach *}
    <span> {* removed n:foreach *}
        {foreach ['a'=>'A','b'=>'B'] as $k=>$v}
            {if $k == $value}
                {$v}
                {breakIf TRUE} {* no close tag anymore *}
            {/if}
        {/foreach}
    </span>
{/foreach}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants