<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OU Campus Archives - Chris Gilligan » new media</title>
	<atom:link href="https://chrisgilligan.com/ou-campus/feed/" rel="self" type="application/rss+xml" />
	<link>https://chrisgilligan.com/ou-campus/</link>
	<description>portfolio of web work</description>
	<lastBuildDate>Wed, 10 Jul 2019 22:12:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>YouTube Gallery snippet &#038; table transform for OU Campus</title>
		<link>https://chrisgilligan.com/consulting/youtube-gallery-snippet-table-transform-ou-campus/</link>
					<comments>https://chrisgilligan.com/consulting/youtube-gallery-snippet-table-transform-ou-campus/#respond</comments>
		
		<dc:creator><![CDATA[Chris Gilligan]]></dc:creator>
		<pubDate>Wed, 02 Mar 2016 18:20:55 +0000</pubDate>
				<category><![CDATA[Consulting]]></category>
		<category><![CDATA[Content Management Systems]]></category>
		<category><![CDATA[OU Campus]]></category>
		<guid isPermaLink="false">https://chrisgilligan.com/?p=2401</guid>

					<description><![CDATA[<p>Here&#8217;s a neat way to present multiple YouTube videos in a responsive &#8220;gallery&#8221; in OU Campus. This example uses a mix of Bootstrap CSS and CSS specific to the gallery. Thanks to Wooster Web Design for the HTML/CSS/JS. With the YouTube Gallery snippet and XSL transform, you can create a video gallery of multiple YouTube [&#8230;]</p>
<p>The post <a href="https://chrisgilligan.com/consulting/youtube-gallery-snippet-table-transform-ou-campus/">YouTube Gallery snippet &#038; table transform for OU Campus</a> appeared first on <a href="https://chrisgilligan.com">Chris Gilligan » new media</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p style="float: right; margin: 0 0 10px 15px; width:240px; height: auto;">
		<img src="https://d2lehxir4n36oh.cloudfront.net/wp-content/uploads/2016/03/screen-shot-2016-03-02-at-1.13.28-PM.png?x15172" width="240" style="max-width: 100%; height: auto;" />
		</p><p>Here&#8217;s a neat way to <a href="http://www.utc.edu/university-web-services/advanced/youtube-gallery.php" target="_blank">present multiple YouTube videos in a responsive &#8220;gallery&#8221;</a> in OU Campus. This example uses a mix of Bootstrap CSS and CSS specific to the gallery. Thanks to <a href="http://www.woosterwebdesign.com/responsive-youtube-player-with-playlist/" target="_blank">Wooster Web Design</a> for the HTML/CSS/JS.</p>
<p>With the YouTube Gallery snippet and XSL transform, you can create a video gallery of multiple YouTube videos, selectable by clicking thumbnail images.</p>
<p>Here&#8217;s the table transform snippet (add HTML to /_resources/ou/snippets, then create new item in Content &gt; Snippets).</p>
<pre class="theme:monokai lang:default decode:true" title="YouTube Gallery table transform snippet">&lt;table class="ou-youtube-gallery transform" style="width: 100%;"&gt;
	&lt;caption&gt;YouTube Gallery Table&lt;/caption&gt;
	&lt;thead&gt;
		&lt;tr&gt;
			&lt;th width="30%"&gt;Title&lt;/th&gt;
			&lt;th&gt;YouTube ID (code after "watch?v=" e.g. G4RT-prDbIw in youtube.com/watch?v=G4RT-prDbIw or youtu.be/G4RT-prDbIw)&lt;/th&gt;
		&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
			My YouTube Video
			&lt;/td&gt;
			&lt;td&gt;
			G4RT-prDbIw
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
			Another YouTube Video
			&lt;/td&gt;
			&lt;td&gt;
			o5ZymO9UgjM
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
</pre>
<p>Here&#8217;s the XSL template match; this belongs in an XSL file such as common.xsl or interior.xsl.</p>
<pre class="theme:monokai lang:default decode:true " title="XSL template match for YouTube Gallery snippet">&lt;!-- transform YouTube Gallery --&gt;
&lt;xsl:template match="table[contains(@class, 'ou-youtube-gallery')]"&gt;
	&lt;xsl:variable name="id" select="position()" /&gt;
  	&lt;style type="text/css"&gt;
		@import url(//www.yourdomain.edu/_resources/css/youtube-gallery.css);
  	&lt;/style&gt;
	&lt;script type="text/javascript" src="/_resources/js/youtube-gallery.js?x15172" /&gt;

	&lt;div class="well"&gt;
		&lt;!-- THE YOUTUBE PLAYER --&gt;
		&lt;div class="vid-container"&gt;
			&lt;iframe id="vid_frame{$id}" frameborder="0" width="560" height="315"&gt;
				&lt;xsl:attribute name="src"&gt;https://www.youtube.com/embed/&lt;xsl:value-of select="./tbody/tr[1]/td[2]//text()"/&gt;?rel=0&amp;amp;showinfo=0&amp;amp;autohide=1&lt;/xsl:attribute&gt;
			&lt;/iframe&gt;
		&lt;/div&gt;

		&lt;!-- THE PLAYLIST --&gt;
		&lt;div class="vid-list-container"&gt;
			&lt;div class="vid-list"&gt;

				&lt;xsl:for-each select="./tbody/tr"&gt;
					&lt;div class="vid-item" onclick="document.getElementById('vid_frame{$id}').src='https://youtube.com/embed/{td[2]//text()}?autoplay=1&amp;amp;rel=0&amp;amp;showinfo=0&amp;amp;autohide=1'"&gt;

						&lt;div class="thumb"&gt;&lt;img alt="video thumbnail" src="https://img.youtube.com/vi/{td[2]//text()}/0.jpg" /&gt;&lt;/div&gt;

						&lt;div class="desc"&gt;&lt;xsl:value-of select="td[1]//text()" /&gt;&lt;/div&gt;

					&lt;/div&gt;
				&lt;/xsl:for-each&gt;

			&lt;/div&gt;&lt;!--/vid-list--&gt;
		&lt;/div&gt;&lt;!--/vid-container--&gt;

		&lt;!-- LEFT AND RIGHT ARROWS --&gt;
		&lt;div class="arrows"&gt;
			&lt;div class="arrow-left"&gt;&lt;i class="icon-chevron-left icon-large"&gt;&lt;!--scroll left--&gt;&lt;/i&gt;&lt;/div&gt;
			&lt;div class="arrow-right"&gt;&lt;i class="icon-chevron-right icon-large"&gt;&lt;!--scroll right--&gt;&lt;/i&gt;&lt;/div&gt;
		&lt;/div&gt;

	&lt;/div&gt;
&lt;/xsl:template&gt;
</pre>
<p>And here are the .js for scrolling and .css for styling</p>
<pre class="theme:monokai lang:js decode:true " title=".js for scrolling">//www.woosterwebdesign.com/responsive-youtube-player-with-playlist/

$(document).ready(function () {
		    $(".arrow-right").bind("click", function (event) {
		        event.preventDefault();
		        $(".vid-list-container").stop().animate({
		            scrollLeft: "+=336"
		        }, 750);
		    });
		    $(".arrow-left").bind("click", function (event) {
		        event.preventDefault();
		        $(".vid-list-container").stop().animate({
		            scrollLeft: "-=336"
		        }, 750);
		    });
		});</pre>
<pre class="theme:monokai lang:css decode:true ">/* styles responsive YouTube Gallery with scrolling thumbnails */
/** /www.woosterwebdesign.com/responsive-youtube-player-with-playlist/ **/

/*  VIDEO PLAYER CONTAINER
############################### */
.vid-container {
	position: relative;
	padding-bottom: 52%;
	padding-top: 30px; 
	height: 0; 
}

.vid-container iframe,
.vid-container object,
.vid-container embed {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}


/*  VIDEOS PLAYLIST 
############################### */
.vid-list-container {
	width: 92%;
	overflow: hidden;
	margin-top: 20px;
	margin-left:4%;
	padding-bottom: 20px;
}

.vid-list {
	width: 3680px;
	position: relative;
	top:0;
	left: 0;
}

.vid-item {
	display: block;
	width: 148px;
	height: 148px;
	float: left;
	margin: 0;
	padding: 10px;
}

.thumb {
	/*position: relative;*/
	overflow:hidden;
	height: 84px;
}

.thumb img {
	width: 100%;
	position: relative;
	top: -13px;
}

.vid-item .desc {
	color: #21A1D2;
	font-size: 15px;
	margin-top:5px;
}

.vid-item:hover {
	background: #eee;
	cursor: pointer;
}

.arrows {
	position:relative;
	width: 100%;
}

.arrow-left {
	color: #fff;
	position: absolute;
	background: #777;
	padding: 15px;
	left: -25px;
	top: -130px;
	z-index: 99;
	cursor: pointer;
}

.arrow-right {
	color: #fff;
	position: absolute;
	background: #777;
	padding: 15px;
	right: -25px;
	top: -130px;
	z-index:100;
	cursor: pointer;
}

.arrow-left:hover {
	background: #CC181E;
}

.arrow-right:hover {
	background: #CC181E;
}


@media (max-width: 624px) {
	body {
		margin: 15px;
	}
	.caption {
		margin-top: 40px;
	}
	.vid-list-container {
		padding-bottom: 20px;
	}

	/* reposition left/right arrows */
	.arrows {
		position:relative;
		margin: 0 auto;
		width:96px;
	}
	.arrow-left {
		left: 0;
		top: -17px;
	}

	.arrow-right {
		right: 0;
		top: -17px;
	}
}
</pre>
<p>&#8230;and, finally, some instructions for use:</p>
<blockquote><p>Click the Insert Snippet button, then choose category Video/Embedded Media &gt; YouTube Gallery</p>
<p>This will insert a table in which you enter Title and YouTube ID for each video. This creates a gallery as shown below. To insert additional videos, click the cursor on a table row, then click the Table button, and choose Row &gt; Insert Row Before (or after), then enter the additional title and ID.</p></blockquote>
<p>&nbsp;</p>
<p>The post <a href="https://chrisgilligan.com/consulting/youtube-gallery-snippet-table-transform-ou-campus/">YouTube Gallery snippet &#038; table transform for OU Campus</a> appeared first on <a href="https://chrisgilligan.com">Chris Gilligan » new media</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://chrisgilligan.com/consulting/youtube-gallery-snippet-table-transform-ou-campus/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Integrating Content from External Sources into OU Campus Using RSS, PHP, and JavaScript</title>
		<link>https://chrisgilligan.com/consulting/integrating-content-from-external-sources-into-ou-campus-using-rss-php-and-javascript/</link>
					<comments>https://chrisgilligan.com/consulting/integrating-content-from-external-sources-into-ou-campus-using-rss-php-and-javascript/#respond</comments>
		
		<dc:creator><![CDATA[Chris Gilligan]]></dc:creator>
		<pubDate>Tue, 23 Feb 2016 00:50:35 +0000</pubDate>
				<category><![CDATA[Consulting]]></category>
		<category><![CDATA[Content Management Systems]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[OU Campus]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://chrisgilligan.com/?p=2386</guid>

					<description><![CDATA[<p>The web team of the University of Tennessee at Chattanooga&#160;uses PHP and RSS to syndicate blog content, news releases, and calendar events into their main website. PHP SimpleXML is used to parse the XML of the RSS feeds. We import a variety of feeds, from WordPress, from Master Calendar, and from other sites such as [&#8230;]</p>
<p>The post <a href="https://chrisgilligan.com/consulting/integrating-content-from-external-sources-into-ou-campus-using-rss-php-and-javascript/">Integrating Content from External Sources into OU Campus Using RSS, PHP, and JavaScript</a> appeared first on <a href="https://chrisgilligan.com">Chris Gilligan » new media</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p style="float: right; margin: 0 0 10px 15px; width:240px; height: auto;">
		<img src="https://d2lehxir4n36oh.cloudfront.net/wp-content/uploads/2016/02/screen-shot-2016-02-22-at-4.45.18-PM.png?x15172" width="240" style="max-width: 100%; height: auto;" />
		</p><p><strong>The web team of the University of Tennessee at Chattanooga</strong>&nbsp;uses PHP and RSS to syndicate blog content, news releases, and calendar events into their main website.</p>
<p><a href="http://php.net/manual/en/book.simplexml.php" target="_blank" rel="noopener noreferrer">PHP SimpleXML</a> is used to parse the XML of the RSS feeds. We import a variety of feeds, from WordPress, from Master Calendar, and from other sites such as an external athletics CMS. WordPress provides some RSS features, including RSS from categories, tags and search strings, but we have added media attachments and a customized template to output a more complicated RSS feed on the University home page.</p>
<ul>
<li><em>this is a companion blog post for a <a href="https://s3.amazonaws.com/cgilligan-share/OUTC16-presentation-chris-gilligan-php-rss-ou-campus.pdf">presentation</a> given at<br />
<a href="https://www.outc16.com" target="_blank" rel="noopener noreferrer">OmniUpdate OU Campus User Training Conference 2016</a></em></li>
<li><em>shortcut to this blog post:&nbsp;<a href="http://utc.edu/outc16">utc.edu/outc16</a></em></li>
<li><em>links below are production&nbsp;examples of the concepts outlined in this post</em></li>
</ul>
<h2>News releases, events and content from WordPress via RSS</h2>
<p>Example web pages:</p>
<ul>
<li><a href="http://www.utc.edu/sustainability/" target="_blank" rel="noopener noreferrer">OU Campus PHP page with news feed and events feed from WordPress</a></li>
<li><a href="http://www.utc.edu/athletics/" target="_blank" rel="noopener noreferrer">OU Campus PHP page with news feed from SideArm Sports</a></li>
</ul>
<h3>WordPress plugin &amp; PHP to add media attachments to RSS feed</h3>
<p>Example RSS feeds <em>(view XML/XSL styled page in FireFox; View Source to see XML structure, namespaces, node names and structure)</em>:</p>
<ul>
<li><a href="http://watoosa.com/feed/" target="_blank" rel="noopener noreferrer">normal WordPress RSS feed</a></li>
<li><a href="http://blog.utc.edu/news/headlines.xml/" target="_blank" rel="noopener noreferrer">customized WordPress feed with additional namespace and media attachments</a>
<ul>
<li>headlines-customfeed.php&nbsp;<em>(custom feed template)</em></li>
<li>functions.php: load_template&nbsp;<em>(registers and loads the custom feed template)</em></li>
</ul>
</li>
<li><a href="http://gomocs.com/rss.aspx" target="_blank" rel="noopener noreferrer">RSS feed with inline images</a>&nbsp;<em>(open in Firefox to see XML &amp; XSL)</em></li>
</ul>
<p>Custom WordPress RSS feed template, followed by the functions call to load and create it:</p>
<pre class="theme:monokai lang:php decode:true " title="custom-headlines.php goes in (child) template directory">&lt;?php
/*
Template Name: Custom Current Headlines Feed

*/

$numposts = 10;
$category_id = get_cat_ID('Current Headlines');

function custom_rss_date( $timestamp = null ) {
  $timestamp = ($timestamp==null) ? time() : $timestamp;
  echo date(DATE_RSS, $timestamp);
}

function custom_rss_text_limit($string, $length, $replacer = '&amp;hellip;') { 
  $string = strip_tags($string);
  if(strlen($string) &gt; $length) 
    return (preg_match('/^(.*)\W.*$/', substr($string, 0, $length+1), $matches) ? $matches[1] : substr($string, 0, $length)) . $replacer;   
  return $string; 
}

$posts = query_posts('cat='.$category_id.'&amp;showposts='.$numposts);

$lastpost = $numposts - 1;



header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
$more = 1;

echo '&lt;?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'&gt;'; ?&gt;

&lt;rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	&lt;?php do_action('rss2_ns'); ?&gt;
&gt;

&lt;channel&gt;
	&lt;title&gt;&lt;?php bloginfo_rss('name'); wp_title_rss(); ?&gt;&lt;/title&gt;
	&lt;atom:link href="&lt;?php self_link(); ?&gt;" rel="self" type="application/rss+xml" /&gt;
	&lt;link&gt;&lt;?php bloginfo_rss('url') ?&gt;&lt;/link&gt;
	&lt;description&gt;&lt;?php bloginfo_rss("description") ?&gt;&lt;/description&gt;
	&lt;lastBuildDate&gt;&lt;?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?&gt;&lt;/lastBuildDate&gt;
	&lt;language&gt;&lt;?php bloginfo_rss( 'language' ); ?&gt;&lt;/language&gt;
	&lt;sy:updatePeriod&gt;&lt;?php echo apply_filters( 'rss_update_period', 'hourly' ); ?&gt;&lt;/sy:updatePeriod&gt;
	&lt;sy:updateFrequency&gt;&lt;?php echo apply_filters( 'rss_update_frequency', '1' ); ?&gt;&lt;/sy:updateFrequency&gt;
	&lt;?php do_action('rss2_head'); ?&gt;
	&lt;?php while( have_posts()) : the_post(); ?&gt;
	&lt;item&gt;
		&lt;title&gt;&lt;?php the_title_rss() ?&gt;&lt;/title&gt;
		&lt;link&gt;&lt;?php the_permalink_rss() ?&gt;&lt;/link&gt;
		&lt;comments&gt;&lt;?php comments_link_feed(); ?&gt;&lt;/comments&gt;
		&lt;pubDate&gt;&lt;?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?&gt;&lt;/pubDate&gt;
		&lt;dc:creator&gt;&lt;?php the_author() ?&gt;&lt;/dc:creator&gt;
&lt;?php the_category_rss('rss2') ?&gt;
		&lt;guid isPermaLink="false"&gt;&lt;?php the_guid(); ?&gt;&lt;/guid&gt;
&lt;?php if (get_option('rss_use_excerpt')) : ?&gt;
		&lt;description&gt;&lt;![CDATA[&lt;?php get_the_excerpt(); ?&gt;]]&gt;&lt;/description&gt;
&lt;?php else : ?&gt;
		&lt;description&gt;&lt;?php echo '&lt;![CDATA['.custom_rss_text_limit($post-&gt;post_content, 256).']]&gt;';  ?&gt;&lt;/description&gt;
&lt;?php $content = get_the_content_feed('rss2'); ?&gt;
	&lt;?php if ( strlen( $content ) &gt; 0 ) : ?&gt;
		&lt;content:encoded&gt;&lt;![CDATA[&lt;?php echo $content; ?&gt;]]&gt;&lt;/content:encoded&gt;
	&lt;?php else : ?&gt;
		&lt;content:encoded&gt;&lt;![CDATA[&lt;?php the_excerpt(); ?&gt;]]&gt;&lt;/content:encoded&gt;
	&lt;?php endif; ?&gt;
&lt;?php endif; ?&gt;
		&lt;wfw:commentRss&gt;&lt;?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?&gt;&lt;/wfw:commentRss&gt;
		&lt;slash:comments&gt;&lt;?php echo get_comments_number(); ?&gt;&lt;/slash:comments&gt;
&lt;?php rss_enclosure(); ?&gt;
&lt;?php do_action('rss2_item'); ?&gt;
		&lt;/item&gt;
	&lt;?php endwhile; ?&gt;
&lt;/channel&gt;
&lt;/rss&gt;
</pre>
<pre class="theme:monokai lang:php decode:true " title="goes in functions.php to load the custom feed">/* Custom RSS Feed for Home Page headlines */

function create_my_customfeed() {
load_template( get_stylesheet_directory() . '/headlines-customfeed.php');
}
add_action('do_feed_headlines', 'create_my_customfeed', 10, 1);
</pre>
<h3>OU Campus PHP helper file and code asset</h3>
<p>To parse an existing external RSS feed, such as a standard or custom WordPress feed, we use a helper file that employs PHP&#8217;s simplexml_load_string to load the targeted RSS feed, traverse the XML document, select node content, then echo out a block of styled html for each set of targeted XML nodes. The helper file accepts&nbsp;the $feed variable to specify the location of the targeted feed, and the $maxitems variable to specify the number of items to select from the top of the that feed.</p>
<p>On its own, the PHP helper file can be hit in a browser, to verify the targeted feed type exists and is parsed correctly. The browser will return an un-styled&nbsp;html page from the helper file URL.</p>
<p>The OU Campus Code Asset includes the helper file, over-rides the helper&#8217;s default variables, is and is very simple to copy and modify, according to the intended target feed and desired number of items to be presented on the final page. Many different Assets can include a single helper file.</p>
<p><em>(Vinit from OmniUpdate outlined a much better way to handle the feed URL and number of items in his Server Side Scripting class: via PCF Page Parameters.)</em></p>
<h3>PHP file</h3>
<ul>
<li><a href="http://www.utc.edu/_resources/php/get-headlines-gomocs.php" target="_blank" rel="noopener noreferrer">parses feed and displays HTML</a>
<ul>
<li>variables set to defaults for testing
<ul>
<li>may need to verify feed access and XML structure</li>
</ul>
</li>
</ul>
</li>
<li>various types of display html
<ul>
<li>title, excerpt, thumbnail from WordPress</li>
<li>title only from WordPress</li>
<li>RSS feed with formatting or namespaces different&nbsp;from WordPress</li>
</ul>
</li>
</ul>
<pre class="theme:monokai lang:php decode:true" title="/_resources/get-headlines-sidebar.php">&lt;?php

$input = $_SERVER['QUERY_STRING'];
parse_str($input);

if (!isset($feed))//script or page property will choose which feed to display
	$feed = "http://blog.utc.edu/news/headlines.xml/";

if(!isset($maxitems))
	$maxitems = 3;

$file = file_get_contents($feed);
$file = str_ireplace('src="http://', 'src="//', $file);
$file = str_ireplace('media:content url="http://', 'media:content url="//', $file);
$file = str_ireplace('media:thumbnail url="http://', 'media:thumbnail url="//', $file);

$sxml = simplexml_load_string($file);

$i = 0;
	foreach ($sxml-&gt;channel-&gt;item as $item) {
		if (++$i &gt; $maxitems) {
				break;
			}
		$namespaces      = $item-&gt;getNameSpaces( true );
		$content         = isset($namespaces['content']) ? $item-&gt;children( $namespaces['content'] ) : '';
		$content_encoded = isset($content-&gt;encoded)      ? $content-&gt;encoded                         : '';
		$media           = isset($namespaces['media'])   ? $item-&gt;children( $namespaces['media'] )   : '';
		$html       = "&lt;div class=\"row-fluid\"&gt;"
					.     "&lt;h3&gt;&lt;a href=\"{$item-&gt;link}\"&gt;{$item-&gt;title}&lt;/a&gt;&lt;/h3&gt;"
					.     "{$content_encoded}"
					.  "&lt;/div&gt;";
	echo($html);
}
?&gt;
&lt;script&gt;
	$(document).ready(function(){
		$('.sidebar img').removeClass().addClass('thumbnail pull-right span5');
		$('aside.well img').removeClass().addClass('thumbnail pull-right span5');
	});
&lt;/script&gt;
</pre>
<h3>OU Campus Assets</h3>
<ul>
<li>simple structure
<ul>
<li>specify RSS source</li>
<li>number of posts to display</li>
</ul>
</li>
</ul>
<pre class="lang:php decode:true " title="OU Campus Asset">&lt;?php
$feed = "//blog.utc.edu/hr/category/benefits/feed/";
include($_SERVER['DOCUMENT_ROOT']. '/_resources/php/get-headlines-sidebar.php');
$maxitems = 5;
?&gt;</pre>
<p><em>(Vinit from OmniUpdate outlined a much better way to handle the feed URL and number of items in his Server Side Scripting class: via PCF Page Parameters.)</em></p>
<h3>More Speed</h3>
<p>After you verify the final production page, you should set up cron jobs for any external feeds that are created via database calls on the external servers. A&nbsp;WordPress feed will require a bit of PHP and MySQL work to generate the RSS feed. This requires some processing, and will introduce a delay in service of the OU Campus PHP page. To avoid this latency, we create cron jobs on the production server to periodically fetch the feeds and cache them locally on the production server. The speed increase for the final page product is noticeable.</p>
<p>If your OU Campus Sites include development, test, training, or mobile Sites, you will want to duplicate the local static feeds on all of the OU Sites.</p>
<p>If you control an external WordPress site, you can&nbsp;employ caching mechanisms or plugins to more efficiently serve RSS feeds.</p>
<ul>
<li>cache RSS feeds via WordPress plugin, e.g. W3 &nbsp;Total Cache</li>
<li>cron job to fetch feeds to local production servers</li>
<li>minimize external requests for faster page load</li>
</ul>
<p>This cron job can be placed in /etc/cron.hourly to fetch WordPress feeds, check <code>lastBuildDate</code>, and compare that to the existing build date, and create a cached RSS xml file.</p>
<pre class="theme:monokai lang:default decode:true" title="wget the feeds to local via cron">#!/bin/bash

# Preload WordPress Feeds for Website

# UTC News
wget http://blog.utc.edu/news/headlines.xml/ -O /data/web/prod/www/_resources/rss/wp-news.tmp &gt;/dev/null 2&gt;&amp;1
TMP_LASTBUILD="$(xml_grep '/rss/channel/lastBuildDate' --text_only /data/web/prod/www/_resources/rss/wp-news.tmp)"
XML_LASTBUILD="$(xml_grep '/rss/channel/lastBuildDate' --text_only /data/web/prod/www/_resources/rss/wp-news.xml)"
MIMETYPE=`file -b --mime-type /data/web/prod/www/_resources/rss/wp-news.tmp`
if [ "$MIMETYPE" == "application/xml" -a  "$TMP_LASTBUILD" != "$XML_LASTBUILD" ] ; then
    mv /data/web/prod/www/_resources/rss/wp-news.tmp /data/web/prod/www/_resources/rss/wp-news.xml
fi

# Duplicate for development, test &amp; training environments
cp -p /data/web/prod/www/_resources/rss/wp*.xml /data/web/test/www/_resources/rss/
cp -p /data/web/prod/www/_resources/rss/wp*.xml /data/web/test/train/_resources/rss/
cp -p /data/web/prod/www/_resources/rss/wp*.xml /data/web/dev/www/_resources/rss/
</pre>
<p>For other RSS sources, the structure may be different; maybe we can&#8217;t do a <code>lastBuildDate</code> check. And&#8230; some servers may not respond to a default wget request from a shell script. No problem: just specify <code>--header</code> and <code>--user-agent</code>, don&#8217;t do the <code>lastBuildDate</code> check, and just write the RSS XML file.</p>
<pre class="theme:monokai lang:default decode:true">#!/bin/bash

# Preload GoMocs Feeds for Website


# Gomocs.com News
wget  --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" http://www.gomocs.com/rss.aspx -O /data/web/prod/www/_resources/gomocs-news.xml

# Duplicate for development, test &amp; training environments
cp -p /data/web/prod/www/_resources/rss/gomocs*.xml /data/web/test/www/_resources/rss/
cp -p /data/web/prod/www/_resources/rss/gomocs*.xml /data/web/test/train/_resources/rss/
cp -p /data/web/prod/www/_resources/rss/gomocs*.xml /data/web/dev/www/_resources/rss/</pre>
<h2>Event Calendar RSS feeds from Master Calendar via RSS</h2>
<p>Example pages that include feeds from Master Calendar. MC has a very rudimentary RSS output of title, date/time and description. MC caches its RSS feeds by default, and expects a lot of traffic to the feed locations, so it is not so necessary to create cron jobs to fetch them. However, if you have an OU Campus page that fetches and displays a large number of MC feeds, you will see a performance increase by using cron jobs. UTC.edu&#8217;s home page fetches a number of feeds, and we saw a noticeably faster page load after moving these calls to cron jobs.</p>
<ul>
<li><a href="http://www.utc.edu/" target="_blank" rel="noopener noreferrer">home page tabbed calendar</a></li>
<li><a href="http://www.utc.edu/music/" target="_blank" rel="noopener noreferrer">simple sidebar calendar</a></li>
</ul>
<h2>Social Media Streams</h2>
<p><strong>UTC uses a jQuery plugin and PHP</strong>&nbsp;to pull in social media posts for the university account, as well as for individual departments and colleges. This is an easy way to create a social stream sidebar or social wall page.</p>
<ul>
<li><a href="http://codecanyon.net/item/jquery-social-stream/2103997" target="_blank" rel="noopener noreferrer">jQuery Social Stream</a></li>
<li><a href="http://www.utc.edu/read-achieve/" target="_blank" rel="noopener noreferrer">program site with Twitter feed</a></li>
<li><a href="http://www.utc.edu/" target="_blank" rel="noopener noreferrer">home page with multiple feeds in a sidebar stream</a></li>
<li><a href="http://www.utc.edu/mocs-news/" target="_blank" rel="noopener noreferrer">social wall page with YouTube videos</a></li>
</ul>
<p><em>Facebook, Twitter and Instagram require PHP &nbsp;API script for connection to signed apps.<a href="http://lulalake.org/" target="_blank" rel="noopener noreferrer">&nbsp;jquery.imagesloaded</a>&nbsp;is helpful for the wall display</em></p>
<h2>Code Samples</h2>
<p><em>(A compilation zip including all code mentioned in the presentation is available. Comment and subscribe to this post&nbsp;to be notified of updates.)</em></p>
<ul>
<li>WordPress plugin to add media attachments to RSS feed</li>
<li>WordPress functions.php changes</li>
<li>PHP files to parse feeds and display HTML</li>
<li>OU Campus Assets to specify RSS source and set number of posts</li>
<li>cron job to fetch RSS feeds to local server</li>
</ul>
<p>The post <a href="https://chrisgilligan.com/consulting/integrating-content-from-external-sources-into-ou-campus-using-rss-php-and-javascript/">Integrating Content from External Sources into OU Campus Using RSS, PHP, and JavaScript</a> appeared first on <a href="https://chrisgilligan.com">Chris Gilligan » new media</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://chrisgilligan.com/consulting/integrating-content-from-external-sources-into-ou-campus-using-rss-php-and-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Page Caching using Disk: Enhanced 
Content Delivery Network via Amazon Web Services: CloudFront: d2lehxir4n36oh.cloudfront.net
Lazy Loading (feed)

Served from: chrisgilligan.com @ 2026-09-06 18:13:42 by W3 Total Cache
-->