hmm.  at first i half-liked the #empty suggestion.  but then i looked
at your example.   i'd rather stick with #else.  it's conceptually the
same as #if/#else ("if we don't render this, render this instead") so
i think we should stick with the same terms instead of making new ones
to learn.  k.i.s.s.

On Thu, 6 Jan 2005 19:47:54 -0800, Will Glass-Husain <[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.
> 
> Incidentally, I think I'd prefer an alternatate directive, to avoid
> confusion.  Maybe #empty?
> 
> #foreach ($a in $list)
>     a row of items
> #empty
>    nothing found
> #end
> 
> Anyway, this is a significant change to the parser (it requires a change to
> Parser.jjt, rather than just being implemented as a custom directive).  So
> we should probably let this stew a bit before doing anything radical.
> 
> WILL
> 
> ----- Original Message -----
> From: "specialist33" <[EMAIL PROTECTED]>
> To: "Velocity Developers List" <[email protected]>
> Sent: Thursday, January 06, 2005 6:34 PM
> Subject: Re: Just a thought...foreach else ?
> 
> > Tim Colson wrote:
> >>>Exactly. The thing is trivial to read and understand
> >>
> >> Trivial, eh? Heh heh, well so trivial that you then present a null versus
> >> empty case... and dismiss it because it's probably "less common". ;-)
> >
> > It is "trivial to read and understand" *AS PRESENTED*.
> >
> > In the null vs. empty case, a more powerful concept which WOULD NOT WORK
> > using the "trivial to read and understand syntax" this in not the case.
> >
> >>>May I introduce you to "intelligent" views: they tell you when they were
> >>>fed invalid data.
> >>
> >> The view isn't doing it... the Velocity Engine is making the call. That's
> >> my
> >> concern.
> >
> > Conceptually. Sure, the view is being produced by V, but it's still a
> > view, in M/V/C terminology: it has no logic. It's just being a
> > particularly useful view, rather than a weak one.
> >
> >>
> >> But it does bring up another use case that this swank new #foreach/#else
> >> doesn't handle.
> >>
> >> Tables.
> >>
> >> #if ($SHOW_RESULTS)
> >> <TABLE>
> >>  #foreach ($thingy in $results) $thingy
> >>  #end
> >> </TABLE>
> >>
> >> #else
> >> No soup for you!
> >> #end
> >>
> >>
> >> Point is -- you need to put in the magic "do results exist" test outside
> >> the
> >> foreach... so your #else won't help you here, and you'll end up with dual
> >> logic anyway. <grin>
> >> >
> >
> > We use:
> >
> > <table>
> > <tr>
> > headers row
> > </tr>
> > #foreach
> >    do all the rows
> > #else
> >    <td colspan="5"> No results found </td>
> > #end
> >
> > (used my proposed syntax for conveninece, but you get the idea :)).
> >
> > It looks nice: it shows you what information you would have had, had there
> > been any information.
> >
> >> I agree we shouldn't invent the same things... but the trick is that we
> >> all
> >> must have the same, exact, identical wheel.
> >
> > Which is why I asked. So far, you've not convinced me otherwise :).
> >
> > ---------------------------------------------------------------------
> > 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]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to