feulf / raintpl3

The easiest Template Engine for PHP
https://feulf.github.io/raintpl
258 stars 57 forks source link

{loop} sanity checks #109

Open xPaw opened 11 years ago

xPaw commented 11 years ago

In the compiled code, {loop} tag produces pretty big if() with lots of checks to make sure that variable can be looped though. I think that these checks are unnecessary. It should be up to the developer to make sure it's an correct array (just like any other tag, where checks like that are not performed). I already removed that extra if() from my website, and it works just like I expect it to.

feulf commented 11 years ago

I partially agree, for back compatibility is better to keep it this way by default. Performances aren't a big issue.

We can consider to add a new configuration $conf['allow_empty_loop'], but that could be complex to make it work with the loop else tag.

From my iPhone

On Aug 8, 2013, at 1:35 PM, Pavel notifications@github.com wrote:

In the compiled code, {loop} tag produces pretty big if() with lots of checks to make sure that variable can be looped though. I think that these checks are unnecessary. It should be up to the developer to make sure it's an correct array (just like any other tag, where checks like that are not performed). I already removed that extra if() from my website, and it works just like I expect it to.

— Reply to this email directly or view it on GitHub.