Creating a Calendar Feed Asset

Issue/Question

How do I create a calendar feed asset to use on my page?

Environment

  • OU Campus
  • OU Addons

Resolution

  1. Login to OU Campus.
  2. From the top menu bar, select Content > Assests
    Note: This may take a while to load, be patient.
  3. Select the green New button and choose Source Code.
  4. Under the Asset Info section give your asset a name.
  5. Optionally, but recommended, under the Access Settings section, change the Access Group to aab_{site_name} or aab_{site_name}_sm. This will allow only those in the group you select to edit the asset. If you leave this set to Everyone, anyone with access to OU Campus can modify your asset.
  6. Under the Asset Content section:
    1. Chose PHP from the Syntax drop-down menu.
    2. Copy and paste the code at the bottom of this article into the content box, changing values accordingly.
      Note: If you are using the new OU Campus template ensure that you use the code under New Template.
      • $config['calendarid'] - the unique ID associated with the Calendar Addon from which you are wanting to show articles. To find the ID associated with a Calendar Addon, you can do so by logging into OU Addons and selecting Calendars.
      • $config['events'] - Optional. The number of calendar events to display in the feed. If this value is not set, the default value of 3 will be used.
      • $config['style'] - Optional. This number affects the look and feel of the calendar feed on the page. Accepted values are 1, 2, 3 and 4. For a more in-depth description of the various feed style, and some examples, visit our Funny Monkeys Calendar Feed demo page. If this value is not set, the default value of 1 will be used.
      • $config['categoryid'] - Optional. If you want to pull a feed from a particular calendar category, specify its unique ID here. To find the ID associated with a calendar category, you can do so by logging into OU Addons, selecting Calendars, and then clicking on the Manage Categories Manage Categories Icon icon next to the appropriate Calendar Addon listed.
      • $config['target'] - Optional. Specify how the event links should behave when clicked. Setting this value to "blank" will cause the article links to open in a new page/tab. By default, the links will open in the current window.
      • $config['show_location'] - Optional. If the style value has been set to 4, setting this value to "1" will cause the calendar event location to be shown under the event title link.
      • $config['show_description'] - Optional. If the style value has been set to 4, setting this value to "1" will cause the calendar event description to be shown under the event title link.
  7. When done, click the blue Create button.
  8. Click the green Publish button to publish the asset.
  9. Your calendar feed asset is now ready to be used on your pages. Please refer to the Related Articles section for more information on adding the asset to a page.

Calendar Feed Asset Code

Old Template

<?php

// id of the calendar addon, required
$config['calendarid'] = '147';

// number of events to be shown in the feed, default 3
$config['events'] = '3';

// style to use when formatting the feed on the page, default 3
$config['style'] = '3';

// whether or not to open the event link in a new window/tab
$config['target'] = 'blank';

// only affects Style 4
$config['show_location'] = '1';

// only affects Style 4
$config['show_description'] = '1';

// load the functions we need and show the feed based on above settings
include_once ('/var/www/html/_resources/php/calendar/functions.php');
echo calendar_display_feed($config);

?>

 

New Template

<?php

// id of the calendar addon, required
$config['calendarid'] = '147';

// number of events to be shown in the feed, default 3
$config['events'] = '3';

// style to use when formatting the feed on the page, default 3
$config['style'] = '3';

// whether or not to open the event link in a new window/tab
$config['target'] = 'blank';

// only affects Style 4
$config['show_location'] = '1';

// only affects Style 4
$config['show_description'] = '1';

// load the functions we need and show the feed based on above settings
include_once ('/var/www/html/_resources/php/calendar_v2/functions.php');
echo calendar_display_feed($config);

?>

Details

Article ID: 2403
Created
Fri 10/28/16 8:22 AM
Modified
Tue 5/14/19 3:01 PM

Related Articles (1)