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

breakin in the middle of a <repeat> loop in an F3 template file. #1269

Open
eliargon opened this issue May 3, 2023 · 2 comments
Open

breakin in the middle of a <repeat> loop in an F3 template file. #1269

eliargon opened this issue May 3, 2023 · 2 comments

Comments

@eliargon
Copy link

eliargon commented May 3, 2023

in php I can break of a foreach( loop with break;
if there an exquivalent code when in a template code with F3 $this->tpl->render(...)?

@geniuswebtools
Copy link

geniuswebtools commented May 3, 2023

I don't think there's a <break /> tag you could use directly.

What I do is filter my arrays before rendering them, and only passing the relevant data to the view.
Alternatively, I also use <check> inside of the loop if I need to change the output.

Using <check> you could essentially let the rest of the loop run w/o rendering any output, and even though it won't break out of the loop, you'd have a similar result.

@eliargon
Copy link
Author

eliargon commented May 5, 2023

Thanks. That's what I did, but I toght it was cumbersome. Well.... It is still a great template engine.

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