University of Minnesota Duluth block M and wordmark

RSS Feeds for UMD Web Calendar of Events

To use the Events Calendar RSS feed on your HTML page, you'll need to convert it to a php page.

Step one:

Save the file with the file extension .php instead.

Step two:

You will need to edit the code of your page to make sure it still looks right. Change any virtual includes to php requires.
Replace the green part at the beginning and the red part at the end of the code for each as follows:

Old Virtual Include:
<!--#include virtual="/base/umd/header.html"-->

New PHP Require:
<?php require_once('/web/base/umd/header.html'); ?>

Note: The URL in the PHP Require should be the relative URL to the file from the main directory of the web server so it may need to be adjusted from what is used in the virtual include.
For instance, a file here:
that was pulled in with this virtual include: <!--#include virtual="nav.html"-->
would need to use this for a php require: <?php require_once('/web/dept/nav.html'); ?>

Step three:

Add the following snippet of php code where you want the events to appear on your page. You will need to replace the blue part with the RSS URL you get from the generator. If the URL has any spaces in it, you will need to replace those with %20 or else you'll get an error.

This sample will create an unordered list with each event as a list item.

<!-- RSS feed Starts -->
    <?php require_once('/web/base/rss/'); ?>
    <?php $rss = fetch_rss($url='GENERATED_RSS_URL_HERE'); ?>
    echo "<ul>\n";
    foreach ($rss->items as $item) {
        $url = $item['link'];                   /* URL to the full listing in */
        $title = $item['event']['title'];       /* Title */
        $date = $item['event']['startdate'];    /* Start Date */
        $time = $item['event']['starttime'];    /* Start Time */
        $where = $item['event']['location'];    /* Location */
        $spons = $item['event']['sponsors'];    /* Sponsor */
        $teaser = $item['event']['teaser'];     /* Teaser text */
        echo "<li>$date @ $time - <a href=\"$url\">$title</a> - $teaser; $where; Sponsored by $spons</li>\n";
    echo "</ul>\n"; ?>
<!-- Feed Ends and text below feed follows -->

You do not need to adjust any other parts of the code but you can change parts of the generated HTML or use other parts of the RSS feed if you decide to.

See more advanced options for the RSS feed formatting.

Don't forget to change your links to the page now that it has a new file extension.

Did you find what you were looking for? YES NO

Choose appearance:
[ Desktop | Mobile friendly ]