

What's a conditerator? - dugmartin
http://tierratemplates.com/blog/2009/09/whats-a-conditerator/

======
shaunxcode
Wait, how is this any cleaner/better than a ternary statement? Beyond that the
initial ugliness comes from using conditional markup in the first place. The
only thing that is going to fix that is abstracting yourself from markup
entirely.

~~~
dugmartin
Conceptually its the same as a ternary statement with the addition that the
output is looped over if the expression evaluates to an array.

Conditional markup is necessary somewhere in the system - this puts it in the
templates in more compact form that won't break like the multi-line block in
the example.

If you put the markup in the controller then you blur the line in the MVC
architecture.

~~~
shaunxcode
Ok, the syntax does not exactly lend itself to clarity. If you're going to be
parsing why not add key:value pairs so you don't have to use the back tick?
Something like:

{@ users ? before: "<div id='users'>Users<ol>" each: "<li>{fullname}</li>"
after: "</ol></div>" else: "No users found" @}

------
nathanwdavis
While the first example that uses separate if and foreach structures is more
lines of code, I find it easier to read. It quickly makes sense to someone
with just a basic knowledge of common code structures.

I prefer to use something that is more readable, even it is more lines of
code.

------
mcantor
Oh, dear.

------
cmars232
Do not want.

