<?php
// Set the MagpieRSS path, this one is in "rss" in the site root
include('rss/rss_fetch.inc');

// Set Feeds and Headers
//feed1
$rss_title1 = "BBC News"; 
$rss1 = fetch_rss('http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml');
//feed2
$rss_title2 = "BBC Hereford & Worcester News"; 
$rss2 = fetch_rss('http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/england/hereford/worcs/rss.xml');
//feed3
$rss_title3 = "ViArt  News"; 
$rss3 = fetch_rss('http://www.viart.com/articles_rss.php?category_id=21');
$newline ="<br>";
$subscribe = "Subscribe";


// Set error reporting for this
error_reporting(E_ERROR);
//Create the table to hold the feeds
echo "<table border=\"0\" cellpadding=\"5\" align=\"center\"><tr><td>";

        //-------Fetch Feed 1 in cell 1 

if ($rss1)
{
 // Split the array to show first 5
 $items = array_slice($rss1->items, 0, 5);
 // Header 1 and new line
 echo $rss_title1.$newline;
 // Cycle through each item and echo
 foreach ($items as $item )
 {
 
 echo "<li><a href=" . $item['link'] . " \" target=\"_new\">" . $item['title'] . '</a> </li>';
 }
}
else
{
  echo '<h2>Error:</h2><p>'.magpie_error().'</p>';
}

// end cell 1 and start cell 2
echo "</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>";


        //-------Fetch Feed 2 in cell 2 
if ($rss2)
{
 // Split the array to show first 5
 $items = array_slice($rss2->items, 0, 5);
  // Header 2 and new line
  echo $rss_title2.$newline;

 // Cycle through each item and echo
 foreach ($items as $item )
 {
 
 echo "<li><a href=" . $item['link'] . " \" target=\"_new\">" . $item['title'] . '</a> </li>';
 }
}
else
{
  echo '<h2>Error:</h2><p>'.magpie_error().'</p>';
}
// end cell 2 and start cell 3
echo "</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>";

                //-------Fetch Feed 3 in cell 3 
if ($rss3)
{
 // Split the array to show first 5
 $items = array_slice($rss3->items, 0, 5);
 // Header 3 and new line
  echo $rss_title3.$newline;

 // Cycle through each item and echo
 foreach ($items as $item )
 {
 
 echo "<li><a href=" . $item['link'] . " \" target=\"_new\">" . $item['title'] . '</a> </li>';
 }
}
else
{
  echo '<h2>Error:</h2><p>'.magpie_error().'</p>';
}
// Finish the Table
echo "</td></tr></table>";

// Restore original error reporting value
@ini_restore('error_reporting'); 

?>
