oops, only sent this to Tim the first time around... On Thu, 6 Jan 2005 16:46:35 -0700, Tim Colson <[EMAIL PROTECTED]> wrote: > > ;-) hah. bet you never thought that would be used in favor of adding > > a feature! > Indeed. ;-) > > > 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! > Hmm... didn't you once argue that null isn't the same as "no results"? Or > was that me? ;-)
i honestly don't recall. but i wouldn't put anything past me. :) > So if #foreach ($result in $thingy.foo.results) dies when foo is null, that > means semantically "no results". > > Smells like biz logic weirdness to me. > > > i don't see how doing #else > > is any more business logic than your example. > Your example: template engine makes the decision on what means True/False. > My example: template engine just tests a Boolean for true/false. > > Less magic in mine than yours. ah, i see what you're saying. hmm. perhaps it would help to change perspective. rather than see this as a true/false type evaluation, see it as a render/no-render situation. then the template engine is only responding to its own behavior rather than evaluating an external condition. in other words, it says "i didn't render this, so i should render this instead" (apologies for the anthropomorphizing). > > 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). ;-) > > I always tend to side with keeping the templates dead simple. Adding a > #foreach/#else smells like syntactic sugar that can be accomplished in the > existing system with less uncertainty on the rules. i don't think there need be any uncertainty. it is simple. if we don't render the loop contents, we render the #else contents instead. it is purely a view decision. and while it does add "syntactic sugar" to the template *language*, the actual templates will become cleaner and simpler. > Another way -- I don't like the idea of telling a Template author that "#if > #else" is triggered whenever "$results is empty... or maybe null... or well, > if anything in there just plain blows up... or some other mystery buried in > the Velocity Engine" whether $results is empty or null or invalid still doesn't matter to our hypothetical template author. all that matters is that there are no results to be rendered. > > 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. > Ha -- well, since the dude who suggested it won't lower himself to login to > bugzilla... I doubt you'll see a patch entered by him. <grin> > > But it seems other folks like the idea too... so maybe they'll scratch. i can hope! (and you can dread? ;-) > Cheers, > Timo > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
