Forumlar / Cotonti / Development / Twig: modern template language

GHengeveld
#25966 2010-09-07 16:33
Well, modulo operator is something that is available in pretty much every template language, and its not hard to see why. Modulo is just much more flexible than assigning a tag named ODDEVEN, because you are not limited to odd/even. What if you want to have 3 different colors alternating in your table rows instead of two? Also, I've noticed that the ODDEVEN tag isn't always available.

I can agree to the CONTAINS/HAS argument; they probably wont be used as much. Main usage would be to see if a user is member of a usergroup:
<!-- IF {PHP.subgroups} HAS 'moderators' -->
You are a member of the 'moderators' user group.
<!-- ENDIF -->
As to performance, it won't matter much, since the code is only executed when actually used. If the other devs want them taken out I can live with that, I say its their call.