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)how do I show a list of previous events?
Pages: [1]   Go Down
Print
Author Topic: how do I show a list of previous events?  (Read 259 times)
0 Members and 1 Guest are viewing this topic.
noranorth
Guest
« on: January 04, 2005, 01:43:00 PM »

I want to use ssi to pull in a list of 5 recent (as in past) events. I was thinking of somthing along the lines of the ssi_max_events.html template but I want the past 5 events and not the next five events. How would I modify that template or write my own to include previous events?

I'm able to use ssi and am not having trouble otherwise. Here is what I created for my ssi.html template -- but the duration part is evidently wrong as it don't seem to work. Any help would be appreciated.

<%
&getEvents( {'duration'=>'-5d'} );
%>

<%FOREACH EVENTLIST%>
   <%IF EVENTS EXIST%>

   
<%FOREACH EVENT%>

<img src="http://www.oneworldexpedition.com/images/<%= EVENT FIELD(photo) %>.jpg" alt="<%= EVENT FIELD(photo_description) %>" height="<%= EVENT FIELD(photo_height) %>" width="<%= EVENT FIELD(photo_width) %>" border="0" align="<%= EVENT FIELD(photo_align) %>"><b><%= EVENT FIELD(boldeddate) %>.</b> <%= EVENT FIELD(description) %>
<br clear="all">
<hr width="390" color="#FFFFFF">

<%/FOREACH%>


   <%/IF%>

<%/FOREACH%>

<%unless($total_events){%>
<i>No Update</i>
<hr width="390" color="#FFFFFF">
<% } %>

Thanks,
nora@homepagedesign.biz

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: January 04, 2005, 03:09:00 PM »

As per the Documentation: Customization, &getEvents routine will accept a startdate and enddate parameter which should allow you to specify the number of day's events (either forward or backward) for a template to retrieve.    
quote:
Retrieving Events

Each template is responsible for retrieving the events it wishes to display, if any. This is the job of the &getEvents() and &getEvent() subroutines.

The &getEvents() subroutine takes arguments which define which range of events to retrieve, then gets the events and schedules from the database and populates most of the variables and special tags listed above. The arguments are given in the form on a hash table of values. For example,
&getEvents( {range=>'month'} );
This will retrieve all events and their schedules for the current-displayed month.

The list of possible arguments to the function are as follows:
- startdate : A date in the yyyymmdd format which will be the starting point of the date display range.
- enddate : A date in the yyyymmdd format which will be the ending point of the date display range.
- range : One of their 'month' (default), 'week', 'twoweek', 'threeweek', 'fourweek', 'year' or 'day'.
- duration : A number, followed by either 'h' or 'd' or 'w'. This specifies the number of hours, days, or weeks to span from the beginning date. For example, '3d' would retrieve events for the next 3 days.
- year : The year of the begin date
- month : The month of the begin date
- date : The date of the begin date
- start : The string 'today' or a Perl gmtime() value to use as the start date of the display range.
- end : A Perl gmtime() value to use as the end date of the display range.

The logic to determine the actual begin date and end date of the range to show is:

- Start Date
If a value for 'start' is passed, use it.
If a startdate is passed, use it.
Construct a startdate value from the year, month, and date values passed. If any of these fields are not passed, use the currently displayed date's value.

- End Date
If a value for 'end' is passed, use it.
If an enddate is passed, use it.
If a duration is passed, add it to the start date and use that as the end date.
If any value is passed for 'range' calculate that range from the start date, and use it.
Default to a monthly display from the start date

So, to retrieve the current month's events, all you would even need to use is:
&getEvents({});
Since the range defaults to 'month' and the start date defaults to the currently displayed date.


You'll then have to figure out how to limit the display to just 5 events as such an increment is not possible to retrieve via the calendar's built-in functions AFAIK.

Dan O.


[This message has been edited by DanO (edited January 05, 2005).]

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