0

I have a client with an older EE (2.1.1) running Calendar 1.5.3.

They want an event list by day that doesn't display days with no events. I'm using this code at present:

{exp:calendar:cal date_range_start="today" show_days="30" pad_short_weeks="n"} 
 {display_each_day}
  <div class="day_list">
   <h3 class="day">{day format="%l, %F %j"}</h3>
   {if day_event_total == 0}<p>No Events</p>{/if}
    {events}
     <p><a class="event_name" href="#">{event_title}</a> {event_start_date format="%g:%i %a"} - {event_end_date format="%g:%i%a"}</p>
    {/events}
  </div>
 {/display_each_day}
{/exp:calendar:cal} 

Which essentially works aside from the fact that of course all days with no events display with the message. They're reasoning that there's no need to show a day if there's no event. Is there a way to do this?

MANY thanks in advance!

1

Try adding the {if day_event_total > 0} ... {/if} conditional:

{exp:calendar:cal date_range_start="today" show_days="30" pad_short_weeks="n"} 
 {display_each_day}
  <div class="day_list">
   {if day_event_total > 0}<h3 class="day">{day format="%l, %F %j"}</h3>{/if}
   {if day_event_total == 0}<p>No Events</p>{/if}
    {events}
     <p><a class="event_name" href="#">{event_title}</a> {event_start_date format="%g:%i %a"} - {event_end_date format="%g:%i%a"}</p>
    {/events}
  </div>
 {/display_each_day}
{/exp:calendar:cal} 

If you really wanted to show nothing on days with no events, you could also remove the {if day_event_total == 0}<p>No Events</p>{/if} conditional.

Also, it goes without saying that we recommend updating EE and Calendar at some point. Both versions are quite old. (Make database and file backups before you do)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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