bcosca / fatfree

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!
2.66k stars 446 forks source link

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

Open eliargon opened 1 year ago

eliargon commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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