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
Pages: [1]   Go Down
Print
Author Topic: SSI - Show X # of Events  (Read 537 times)
0 Members and 1 Guest are viewing this topic.
JasonSP
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: April 19, 2002, 02:10:00 PM »

Howdy,

I am trying to have my SSI that is shown on my index.html page only show the first 5 events.  I have only been able to have it show the events for whatever duration I set it to.  So basically is there a way to have the SSI show the next 5 events and not the next 5 days.

Also what do I need to do to have the output from the SSI show the date in abbreviated format like 01/22 instead of showing it like April 21.

Here is the code I have:


<%&getEvents( {'duration'=>'90d'} );$total_events=0;%>
<style><!--A.minical { text-decoration:underline; }A.minical:hover { text-decoration:none; }.minical { color:#660000; }--></style>
<TABLE cellspacing=1>
 <%EVENTLOOP:%>
 <%FOREACH EVENTLIST%>
 <%IF EVENTS EXIST%>
 <%$curr_events=0;%>
 <%FOREACH EVENT%>
 <%$total_events++;%>
 <%if (total_events==5) {last EVENTLOOP;} %>  
 <%$curr_events++;%>
 <%/FOREACH%>
 <tr>
   <td height=1></td>
 </tr>
 <tr>
   <td align=center valign=middle rowspan="<%=$curr_events%>"> <font face="Arial, Helvetica, sans-serif" size="2"><%=$DAY->{monthname}%>
     <%=$DAY->{dd}%></font></td>
   <%$curr_events=0;%>
   <%FOREACH EVENT%>
   <% if ($curr_events) { %>
 <tr>
   <% } $curr_events++; %>
   <td><font size="2" face="Arial, Helvetica, sans-serif"><img src="/nolaaggie/images/spacer.gif" width="20" height="1">
     </font></td>
   <td><font size=-1> <A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" class="minical">   
     <%=$EVENT->{'details'}->{'title'} %></a> </font></td>
 </tr>
 <%/FOREACH%>
 <%/IF%>
 <%/FOREACH%>
 <%unless($total_events){%>
 <tr>
   <td align=center><I>No Events</I></td>
 </tr>
 <% } %>
</table>

Thanks for the help in advance!

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: April 19, 2002, 03:54:00 PM »

I think limiting the number of events to be displayed via the SSI template is covered in a previous forum message at: http://www.calendarscript.com/support/forum/Forum4/HTML/000218.html

Just make sure to set the template's duration appropriately. For example if you've set the duration to 1 month, on the 31st of the month it will NOT show any of the events for the next month. So maybe set the duration to 2 months if you think that may be a problem.

Dan O.

[This message has been edited by DanO (edited April 19, 2002).]

Logged
JasonSP
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: May 13, 2002, 08:37:00 PM »

I tried doing what that post said but it didn't work for me.  Any other suggestions?  Thanks

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

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #3 on: May 14, 2002, 02:56:00 AM »

Try this:

<%&getEvents( {'duration'=>'90d'} );$total_events=0;%>
<style><!--A.minical { text-decoration:underline; }A.minical:hover { text-decoration:none; }.minical { color:#660000; }--></style>
<TABLE cellspacing=1>
<%$total_events = 0;%>
<%FOREACH EVENTLIST%>
<% last if $total_events >= 5; %>
<%IF EVENTS EXIST%>
<%$curr_events=0;%>
<%FOREACH EVENT%>
<%$curr_events++;%>
<%last if ($total_events + $curr_events >= 5); %>
<%/FOREACH%>
<tr>
<td height=1></td>
</tr>
<tr>
<td align=center valign=middle rowspan="<%=$curr_events%>"> <font face="Arial, Helvetica, sans-serif" size="2"><%=$DAY->{monthname}%>
<%=$DAY->{dd}%></font></td>
<%$curr_events=0;%>
<%FOREACH EVENT%>
<% last if $total_events++ >= 5; %>
<% if ($curr_events) { %>
<tr>
<% } $curr_events++; %>
<td><font size="2" face="Arial, Helvetica, sans-serif"><img src="/nolaaggie/images/spacer.gif" width="20" height="1">
</font></td>
<td><font size=-1> <A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" class="minical">
<%=$EVENT->{'details'}->{'title'} %></a> </font></td>
</tr>
<%/FOREACH%>
<%/IF%>
<%/FOREACH%>
<%unless($total_events){%>
<tr>
<td align=center><I>No Events</I></td>
</tr>
<% } %>
</table>

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

simonwh
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #4 on: January 21, 2003, 07:50:00 PM »

That bit of code worked OK for me except where I had an event that spanned more than one day. it treated each day as as separate event so when I listed 5 events 3 were showing the same thing

can anyone help?

thanks

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

Logged
Sachin Khanna
Guest
« Reply #5 on: November 08, 2003, 04:12:00 PM »

This solution will do the following:
* List the next 10 events, but it will complete the day the last event occurs even if the with the remaining events in that day, regardless of how many.

* There is another minor addition below if you just want the number of events without caring about it stopping in the middle of the day if it number of events exceed your specified events.

This is what you need to do:
1) The code above the <BODY> tag should look like this:
<%
&getEvents( {'duration'=>$in{duration}} );
$DAY = $Grid->{'grid'}->

  • ->
  • ;
    $EVENTS = $DAY->{events};
    $total_events=0;
    $curr_events=0;
    %>

    2) Add line
    <% last if $curr_events >= 10; %>
    after
    <%FOREACH EVENTLIST%>

    3) Add line
    <%$curr_events++;%>
    after
    <%FOREACH EVENT%>

    That's it to achieve the above stated solution. You can very easily modify that to make it only achieve 10 events:
    1) Add line
    <% last if $curr_events >= 10; %>
    after
    <%FOREACH EVENT%>
    but, before
    <%$curr_events++;%>

    I think this is a much smaller solution than any of the ones stated before. Just make sure you call the calendar script with sufficient days so at least 10 events (in this case will be available)

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