On Thu, 6 Jan 2005 15:37:18 -0700, Tim Colson <[EMAIL PROTECTED]> wrote:
> > That's a clever idea for a shortcut.
> Agree it's interesting, but I'm unsure it will be easy to agree on what
> constitutes "true/false" to trigger the #else. Plus, well, the paradigm is a
> bit wacky. I mean, even perl doesn't have an 'else' clause for a loop
> construct. <grin>
as one former pillar of this community used to say: "this isn't Perl"
;-) hah. bet you never thought that would be used in favor of adding
a feature!
as for what would trigger the #else, i should think that is obvious.
the #else statement is rendered anytime the #foreach doesn't render
its innards for whatever reason. i think we can all very easily agree
on that!
> The rule for true/false smells like business logic... which I personally
> don't like putting in my templates, so I cringe at the idea of the Template
> Engine embedding it. :-(
>
> The backend can worry about the goofiness of java .length/size/size() and
> just set a simple:
> context.put("SHOW_RESULTS", new Boolean(myResultList.hasStuffInIt() &&
> user.isAuthorized() );
>
> #if ($SHOW_RESULTS)
> #foreach ($result in $list_of_results)
> $result
> #end
> #else
> No results to show!
> #end
i don't see how doing
#foreach( $result in $list_of_results )
$result
#else
No results to show!
#end
is any more business logic than your example.
and even if it is, i've always tended to side with elegance over
pure-MVC-ism (thus my interest in Pull-MVC and VelocityTools). ;-)
still the real deciding factor will be whether anyone steps up to
scratch this itch with a patch. i wish i could say i would, but i
know i won't ever get to it.
> And of course, that could be wrapped in a macro or two.
>
> Timo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]