I can't seem to figure out why the no_results tag isn't working for the Who's Attending page I'm working on. I have one page that lists all of the current events. You can click on any of the event titles to bring up a page that lists all attendees (entries with approved status). This is working very well but whenever you click on an event that doesn't contain entries with an approved status the no_results tag doesn't work. Below is the code I'm using:
<p>You have selected <strong>{last_segment}</strong></p><hr/>
<p>Please find below the list of attendees for this event:</p><br>
<ul>
{exp:channel:entries channel="event_registration" status="Approved"
limit="300" search:event="{last_segment}"}
<li>{registrant}</li>
{if no_results}<p>No one has registered for this event yet.</p>{/if}
{/exp:channel:entries}
</ul>
I have tried the adding 'require_entry="yes"', adding dynamic="yes" and dynamic="no" to no avail. I've also tried using the three methods below:
{if total_results == "0"}No one has registered for this event yet.{/if}
{if count < 1}<p>No one has registered for this event yet.</p>{/if}
{if count == 0}<p>No one has registered for this event yet.</p>{/if}
I'm still unable to get the no results message to display. It should also be noted that if I add a {count} tag to my template it will output the total number of entries if there is at least one entry. The {count} tag doesn't output 0 or anything at all if there aren't any entries. Any tips or suggestions for getting this working would be greatly appreciated, Thanks!
{exp:channel:entries}
query, does it output anything at all? It sounds to me like that query isn't actually doing anything, so any code you have inside it (including theif no_results
statement) isn't even executing? If you put <p>Test</p> inside the query, does it output that to your browser? I'm also pretty sure dynamic will need to be set to yes because you're basing the query on a dynamic URL .