The current OSU Events Calendar was built in March 2006 to provide a long-term web calendar solution for Oregon State University. The calendar was designed in-house to meet the most common public calendaring needs for departments and groups. However, it was realized that no single calendar application could fit everyone's needs, so flexibility and extensibility remained paramount. With data import and export tools, the web calendar serves as a central storage platform for distributed event data. A centralized data source allows individuals to easily find information. Providing export in standard formats allows event data to be accessed and integrated into other web sites and applications.
Central Web Services has written a library to simplify adding OSU Events calendar data to your websites. This script requires PHP to execute.
If you are using OSU Drupal, integration of the calendar is taught in the Formatting Blocks course. You do not need to include the file in OSU Drupal.
Update: Drupal sites now come with the Feeds DIsplay module, which makes it very easy to add the News and Events feeds to your site.
<?php require_once('calendar_rss.php'); ?>
The views output simple HTML (a table, for the mini-month, a definition list for the list view) that can be styled via CSS.
More control over the HTML output is possible; this requires a PHP installation that support XSLT (which includes all CWS hosted sites). See Advanced Formatting for a brief description.
This library makes use of RSS caching when run on CWS hosted sites; for other sites, it might be a good idea to implement some type of caching. Parsing remote RSS feeds on the fly will noticeably slow down your web pages.
A list can be dynamically generated to show the current week's events pulled from the main ('osu') calendar, using this code:
<?php echo minical_list('osu', 'today', 'week'); ?>
today' could also be a date ('20060425'), or include an offset ('today+6', '20060401+13')
'week' could also be one of 'day' or 'month'
The easiest way to show the current month's events would be:
<?php echo minical_list('osu', 'today', 'month'); ?>
The minicalendar is dynamically generated, but uses the 'month' interval instead.
<?php echo minical_month('osu','today','month'); ?>
The minical_month() function accepts the same parameters as minical_list().
For an example of how to style the minimonth, see the minimonth.css stylesheet.
If you don't need feedback about current events on the calendar, it's much faster to build the minicalendar without any event data:
<?php echo minical_empty_month('osu','today','month'); ?>
If the default HTML markup isn't good enough (perhaps you want to show some additional RSS fields, or integrate the calendar data into an page structure), you can control the layout completely by writing an XSL template. Put the XSL template in a file, and pass it into the minical_month function:
<?php echo minical_month('osu','today','week','month_stylesheet.xsl'); ?>
Using the minical_month function, an XSL stylesheet, and any combination of date and range, you can produce your own month, a differently formatted list, or anything else.
A sample XSL stylesheet, for producing a minimonth. Writing XSL is far beyond this page; you should be familiar with XML basics before trying. A web search for XSL tutorial should turn up some useful information.