Most of the news, article and blog websites on the Internet use RSS feeds to syndicate their content to users and other websites. In this article I will give you a brief introduction to RSS and what its uses are, as well as a quick guide on how to include an external RSS feed as a panel in ArticleLive.
So, you have an RSS feed link, but what can you do with it? The most common use is to add it to an RSS reader program such as Google Reader, FeedReader, Awasu and their popular online cousin BlogLines.com. Yahoo, MSN and Google also allow you to input feed URL's for your own customized homepage with news stories and articles from websites of your own choosing.
Once downloaded, all you need to do is place the program in a sub folder on your web site (purely to be tidy, it can be placed anywhere). Then run a simple bit of PHP code on your web page:
<?php
include_once('magpierss/rss_fetch.inc');
$rss = fetch_rss("http://www.interspire.com/content/articlerss.php");
echo "<h3>" . $rss->channel['title'] . "</h3><p>";
echo "<ul>";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
echo '<li><a href="'.$href.'">'.$title.'</a></li>';
}
echo "</ul>";
?>
I will now demonstrate how to include a feed as a panel in ArticleLive. The first step is to include the Magpie RSS files. Open up your init.php file (in the base directory of ArticleLive) and locate this code near the top:
ob_start();
Place the include after this line, so it looks like this:
ob_start();
include_once('magpierss/rss_fetch.inc');
Now that we have included the files, the functions will be available to use throughout the entire application. This also means that we can include multiple feeds without including the file more than once.
We now need to create a new panel file set. Navigate to /templates/{your template}/Panels/ and create 2 new files; InterspireArticles.html and InterspireArticles.php (the file names should be exact).
InterspireArticles.php will look like this:
<?phpOur InterspireArticles.html file will have the following content:
<table class="Panel RootArticleCategoriesPanel" id="Table1">
<tr>
<td class="Heading">
%%GLOBAL_title%%
</td>
</tr>
<tr>
<td style="padding:10px 0px 10px 0px ; ">
%%GLOBAL_ArticleList%%
</td>
</tr>
</table>
Now all we need to do is open up the directory /templates/{your template}/ and place the placeholder %%Panel.InterspireArticles%% in the appropriate place in the panels HTML code.
We want it to appear on the top of the right hand side, so we will place it before %%Panel.DefaultRightColumnPanel%% in all the main .html files such as Default.html, Articles.html, Blogs.html etc.
Note: The placeholder is determined by the File name. If you created a panel with the file names MyPanel.php and MyPanel.html, then you would use %%Panel.MyPanel%% as the placeholder.
You panel will now show up with the links straight from our the feed. This can be used for any RSS feed and allows your site to be updated with the latest news and information automatically.
As you can see, RSS and syndication in general are powerful tools for displaying content. Because the information is readily available in a standard format, it requires very little effort to have new content and information at your finger tips. If you are using an RSS reader program or website, this standard allows you to gather headlines and content from a wide variety of sites all into one convenient location.
There are many pages with further information on the RSS standard; a simple Google search will return millions of pages as well as information on competing syndicate standards such as Atom.
Content is the king of the Internet, and the race is on for websites to get their content out there and one of the most efficient and effective methods is through syndication.