Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Calendar Script CommunityCustomizationCustomizing CalendarScript (Moderators: scott, DanO, Marty)Displaying selected events using ssi.html
Pages: [1]   Go Down
Print
Author Topic: Displaying selected events using ssi.html  (Read 299 times)
0 Members and 1 Guest are viewing this topic.
jdillon
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: March 14, 2006, 01:53:00 PM »

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%>

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: March 14, 2006, 03:51:00 PM »

** 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. **

You can't the way you have it written. In that code, if it doesn't find a "yes" it automatically goes on to the next event. That's the the next in the statement means.

Also, that test will occur for each and every event. The result would also occur for each event... ending up in the repeating lines you've already seen.

What you might be able to do is move the <%$total_events++;%> in the original ssi.html template to right after the <% next if ($EVENT->{details}->{public} !~ /yes/) ; %> statement you added so it only starts counting if an even is found to be printed.

Dan O.

------------------

Logged
jdillon
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: March 14, 2006, 06:14:00 PM »

Thanks! That did the trick.

Jon

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #3 on: March 15, 2006, 11:48:00 AM »

Glad to heat it.

Dan O.

------------------

Logged
Pages: [1]   Go Up
Print
Jump to: