myUMBC Announcements
Institutional Group • 156 people
Files / Pulling myUMBC Content to External Sites

Pulling myUMBC Group Content to an External Site

To pull content from your myUMBC group (spotlights, news, etc.), you need to download the files in this document folder and make the following modifications to your website.

1.  At the top of any pages with myUMBC content, include:

IMPORTANT: Make sure you put your Group Token in quotes in the line:
$group = "YOUR GROUP TOKEN HERE";
If you aren't using news, events, etc. remove their lines from this code.

<?php
  require("myumbc_xml.php");
  $group = "YOUR GROUP TOKEN HERE";
  $spotlights = parse_xml($group, "spotlights", "");
  $news = parse_xml($group, "news", "?page=1&page_size=5&mode=recent");
  $events = parse_xml($group, "events", "?page=1&page_size=5&mode=upcoming");
  $media = parse_xml($group, "media", "?page=1&page_size=5&mode=recent");
  $discussions = parse_xml($group, "discussions", "?page=1&page_size=5&mode=recent");
  $news_item_id = "NEWS ITEM ID HERE"
  $news_item = parse_xml($group, "newsitem_" . $news_item_id, "");
  $event_id = "EVENT ID HERE";
  $event = parse_xml($group, "event_" . $event_id, "");
?>

2. Just before your </head> tag, include:

<link rel="stylesheet" href="spotlight.css" type="text/css" />
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="spotlight.js"></script>

3a. Where you want News Listing:

IMPORTANT: Make sure to populate the "Content when no news is being pulled..." section to display default news if none is available through myUMBC. 

<?php if ($news) { ?>
  <div id="news">
    <h3>Recent News</h3>
    <ul>
    <?php while(list($key,$val) = each($news)): ?>
      <li class='item-<?= $key ?>'>
        <div class="title"><a href="http://my.umbc.edu/groups/<;?= $group ?>/news/<?= $news[$key]["id"] ?>"><?= $news[$key]["
title"] ?></a></div>
      </li>
    <?php endwhile; ?>
    </ul>
    <div class="more"><a href="http://www.umbc.edu/oit/news/">more news...</a>     </div>
  </div>
<?php } else { ?>
<!-- TODO: Content when no news is being pulled through myUMBC -->
<?php } ?>

3b. For Events, Media, Discussions Listings:

Replace $news in the above code with $events, $media, or $discussions.

3c. Where you want an Individual News Item:

<?= news_item["title"] ?>

Other information about the news item can be retrieved using the above line of code and replacing title with one of the following:

  • tagline
  • posted_at
  • body
  • thumbnail (see example code for exact syntax for thumbnails)
  • avatar_url
  • group_url
  • group
  • sponsor
  • website
  • attachment_url
  • attachment_kind
  • tags
  • audiences
  • topics
  • paw_count
  • comment_count

3d. For Individual Events:

 

Replace $news_item in the above code with $event. Additional information that can be pulled out an event include:

  • start_date
  • end_date
  • summary
  • location name (see example code for exact syntax for location information)
  • location latitude (see example code for exact syntax for location information)
  • location longitude (see example code for exact syntax for location information)
  • attendee_count
  • attendee_max

3e. For Spotlights:

IMPORTANT: Make sure to populate the "Content when no spotlights are being pulled..." section to display default spotlights if none are available through myUMBC. 

<?php if ($spotlights) { ?>
  <div class="spotlight-widget">
    <div class="panels">
      <?php while(list($key,$val) = each($spotlights)): ?>
        ..........etc. (full code in downloadable archive)
  </div>
<?php } else { ?>
  <!-- TODO: Content when no spotlights are being pulled through myUMBC -->
<?php } ?>