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 EventsEach 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).]