Obtaining an XML Feed from Events@Duke
Note: Group names follow the format agrp_groupname. When you are logged into Event Administration, the group name is displayed in the page banner.
Direct XML feed
To obtain a calendar style XML feed for a group (or groups) out of Events@Duke, copy and paste the link below into your browser's address field. Replace groupname with the appropriate group name, or with a list of group names separated by commas. This feed will show events for the current week. Read more about feed types and parameters.http://calendar.duke.edu/cal/main/setViewPeriod.do?skinName=feed&setappvar=group(agrp_groupname)&viewType=weekView
PHP code snippet
Use this code snippet to use PHP to consume an XML feed.
Note: PHP 5 or PHP's SimpleXML library must be installed (SimpleXML is bundled with PHP 5).
- Download and unzip the sample PHP code.
- At the top of the file, you'll find a number of configurations. On the line that states
$group = "agrp_NasherMuseumofArt";replace agrp_NasherMuseumofArt with the name of your group, or with a list of group names, separated by commas.
- Upload the file to your Web server.
- On the desired Web page, use PHP's "include statement" (http://us.php.net/include) to include the file in the desired location.
- In the eventcal.js file, change
var eventContainer = "events";to the id of the element you wish the events to appear in.
- Upload the scripts to your Web server.
- Add the following two script tags to the <head> region of your page (make sure the src attribute is correct):
- Add a third script tag immediately preceding the closing </body> tag, and replace agrp_NasherMuseumofArt with your group's name, or a list of group names separated by commas:
(The above script tag should be one line.)