0

I have an events listings. Events are by “start_date”. When I have no events I want to display “NO EVENTS SCHEDULED” When I have events I want to remove the NO EVENTS SCHEDULED. I can’t seem to get the conditionals right. Need help, can not seem to get my head around it.

{exp:channel:entries channel=“Events” sort="asc" orderby="start_date"}
{if star_date == ""} <h1>No Events Scheduled</h1>{/if}
{if start_date} <h4><strong>{title}</strong></h4>{/if}

{start_date format="%l, %F %j, %Y; %g:%i %a"}</><br>
{rentals_main_copy}
{if start_date} <span>New Vic, 33 W. Victoria Street, Santa Barbara, CA, 93101 (<a href="/visit/location">map</a>)</span> {/if}
{if start_date}<hr class="bottom-2">{/if}

 {/exp:channel:entries}
1
  • Your 1st conditional has a typo in it... missing the 't' from start. Jun 17, 2015 at 6:22

1 Answer 1

2

You could use the search & no_results tag like this and do away with the multiple {if} statements:

{exp:channel:entries channel="Events" sort="asc" orderby="start_date" search:start_date="not IS_EMPTY" }
  {if no_results} <h1>No Events Scheduled</h1>{/if}
  <h4><strong>{title}</strong></h4>{/if}

  {start_date format="%l, %F %j, %Y; %g:%i %a"}</><br>
  {rentals_main_copy}
  <span>New Vic, 33 W. Victoria Street, Santa Barbara, CA, 93101 (<a href="/visit/location">map</a>)</span>
  <hr class="bottom-2">

 {/exp:channel:entries}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.