fatfree icon indicating copy to clipboard operation
fatfree copied to clipboard

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

Open eliargon opened this issue 1 year ago • 2 comments

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(...)?

eliargon avatar May 03 '23 13:05 eliargon

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.

geniuswebtools avatar May 03 '23 14:05 geniuswebtools

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

eliargon avatar May 05 '23 21:05 eliargon