On Fri, 7 Jan 2005 08:55:05 -0700, Tim Colson <[EMAIL PROTECTED]> wrote:
> > I go back and forth.  Sometimes I put the "no results found"
> > outside of the
> > table.  But often it's nice to do it inside (and keep the header) like
> > specialist33.  Depends on the layout.
> Agreed -- the point I was trying to make, poorly, was that there are use
> cases (ex. outside the table) where the template author won't be able to use
> the #empty trick. So they will probably have two parallel condition tests,
> which is generally not a great idea.
> 
> Here's another use case where the expression gives back either a list OR a
> single result.
> 
> #if ($Searcher.thereIsOnlyOne)
>  Only one result == $Searcher.result.name
> #else
>  #foreach ($thingy in $Searcher.result)
>    $thingy.name
>  #end
> #end
> 
> For this case... #foreach#empty would probably not hit #empty... or maybe it
> would because if the Engine tried Searcher.getResult().size() -- it would
> probably die.

and why should it hit #empty (or #else) in this example?  there IS a
result; it isn't empty!  let's not pretend that this is a use case
where #foreach/#else "doesn't work" when this is really just an
example where #foreach/#else *doesn't apply*.  big difference.

> I have a very unique wheel. <grin>
> 
> BTW -- nobody has suggested what happens for $thingy.foo.results when foo is
> null (i.e. is the #else rendered because a) list is empty, b) list is null,
> or c) the expresstion blows up but has nothing to do remotely with results)
 
have too! :)   the #else is rendered because the #foreach block was
not.  we are not changing the behavior of the #foreach block and the
rules for what happens when foo is null for $thingy.foo.results is
used in #foreach are not under debate here.  those are already
established and entirely tangential to the conversation.  we are
simply talking about adding the ability to neatly and cleanly specify
an alternate block to be rendered in the cases (whatever they may be)
where the #foreach block is not.

> Cheers,
> 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]

Reply via email to