We’ve a template which uses an embedded template to output the final data to screen based on results passed to it from the query module.
Basically, we’re wanting to output events showing over the next month, but there may be 2 of the same events on the same day, so we only want to show this event once.
The parent template is outputting the correct data from the database (with php enabled to convert times)
{exp:query sql="SELECT exp_channel_titles.entry_id, exp_channel_titles.status, exp_channel_titles.entry_date, exp_channel_titles.expiration_date, exp_channel_data.field_id_33 AS eventID FROM exp_channel_titles INNER JOIN exp_channel_data ON exp_channel_data.entry_id = exp_channel_titles.entry_id WHERE exp_channel_data.channel_id = '26' AND exp_channel_titles.status = 'open' AND exp_channel_titles.entry_date < '<?=$monthMaxDate;?>' AND exp_channel_titles.entry_date > '<?=$monthMinDate;?>' GROUP BY eventID"}
{embed="theatre/time-based-listing" embedded_event_id="{eventID}"}
{/exp:query}Then in the embedded template, we have:
{exp:channel:entries channel="all_events" search:cf_event_id="={embed:embedded_event_id}" dynamic="no" category="8"}
{if no_results}
{redirect="events/no-results"}
{/if}
<li class="listing theatre">
...output…
</li>
{/exp:channel:entries}However, the no_results output in the embedded template seems to trump all results, so the redirect happens even when there is content to output. Removing the no_results tag shows the output correctly, but obviously then if there are no results, we don’t get our message displayed about no events.
The category is right, and everything seems to work, except the no_results tag. I read somewhere that there was a bug with no_results in embedded templates, so to place a no_results tag in the parent, which I’ve tried but with no success.
Am I missing something here?