I have a simple problem, but am finding it hard to figure out how to execute it in EE.
I have a table of scholarship winners spanning multiple years, with the year existing in the Year channel field. I have the URL established so that a user can specify /scholarship-winners/ and get the most recent year’s scholarship winners, while an optional parameter can be passed in as /scholarship-winners/2009/ and only 2009 winners will appear.
If the parameter passed in does not match any records, I just want to display a simple No results found. without the table and layout for rendering actual scholarship winners.
I can’t seem to figure out how to lay this out in EE, though. What’s the best way to just test to see if channel records exist based on a channel field value, if they exist render a specific kind of layout, and if not display a different kind of layout? Seems easy enough, but I’m not sure how to do it. Both the query module and the channel entries module will iterate over the found set, so I don’t want my successful query to display the scholarship winners 100 times if there are 100 winners. I just need a simple conditional test, like
if entries_exist
display table
if:else
display error dialog
/if
Thanks, in advance, for any assistance!