I am trying to modify ssi.html to display events on my home page only if an event is open to the public. I have created a form field entry called "public" which requires a yes or no answer. If the answer is yes, than the event is displayed, if no, it is not.
I am able to get this to work using
<% next if ($EVENT->{details}->{public} !~ /yes/) ; %>
but I am having trouble making it automatically display "No Events Currently Scheduled" when "no" is selected in the public field. When I set the variable to "no" I either get a blank where I expect the no events message to appear or I get the no events message to appear multiple times (for every event within the ssi.html range), depending on what fix I try.
So what I'm looking for is a way to display the no events message if the "NEXT IF" statement doesn't find a yes in the public field. I've tried variations of IF and ELSE statements within the FOREACH EVENT loop but the closest I've come is getting the no events message to display for all events in the specified range in ssi.html.
I've also tried putting
<%unless($total_events){%><%= $_NO_EVENTS_LABEL %>
outside of the FOREACH EVENT loop but that doesn't seem to have any effect.
I don't know enough programming to figure out my error in logic. Can someone help?
Thanks!
Jon
Here are the pertinent lines of code from my ssi file:
<%FOREACH EVENT%>
<% next if ($EVENT->{details}->{public} !~ /yes/) ; %>
<% if (($_SHOW_EVENT_TIMES eq "ALL" | | $_SHOW_EVENT_TIMES eq "START") && ($EVENT->{'schedule'}->{'start_time'})) { %>
<% } %>
<A target=_top HREF=/cgi-bin/cal/calendar.pl?calendar=inst_events&view=Event&event_id=<%= EVENT FIELD(id)%>&datestring=<%=$DAY->{datestring}%> CLASS=text><%= EVENT FIELD(title) %></A>:
<%=$DAY->{dayname}%>, <%=$DAY->{monthname}%> <%=$DAY->{dd}%>,
<% if ($_SHOW_GRID_EVENT_BULLET) {%><%}%>
<strong>
<% if ($_SHOW_EVENT_TIMES eq "ALL" | | $_SHOW_EVENT_TIMES eq "START") { %>
<% if ($EVENT->{'schedule'}->{'start_time'}) { %><%= SCHEDULE FIELD(start_time) %> - <% } %>
<% } %>
<% if ($_SHOW_EVENT_TIMES eq "ALL") { %>
<% if ($EVENT->{'schedule'}->{'end_time'}) { %> <%= SCHEDULE FIELD(end_time) %><% } %>
<% } %>
</strong>
<%/FOREACH%>
<%unless($total_events){%><%= $_NO_EVENTS_LABEL %>
<% } %>
<%/IF%>
<%/FOREACH%>