<?php
	/* -------------------------------------------------------------- *
	  * rssnews.php - Page to generate an rss feed of news from the   *
	  * database. <<INCOMPLETE AND NOT WORKING!>>                     *
	  * Created Tue 12 December, 2005 @ 1:27PM                        * 
	  * Created by James Hannah                                       *
	  *      (jiphex@gmail.com)                                       * 
	  * Subsequent changes: <<add your name here>>                    *
	  * ------------------------------------------------------------- */
	require_once("bailriggfm.cfg.php");
	include("functions.php");
	

	$headlines = fetchNewsHeadlines(201, "public");
	
	Header('Content-type: text/xml');
  
	echo "<?xml version='1.0'?>\n";
	echo "<rss version='2.0'>\n";
	echo "   <channel>\n";
	echo "       <title>87.7 Bailrigg FM News</title>\n";
	echo "       <link>http://bailriggfm.co.uk/</link>\n";
	echo "       <description>News about 87.7 Bailrigg FM</description>\n";
	echo "       <language>en-gb</language>\n";
	echo "       <managingEditor>".mancomMembers(14)." - web@bailriggfm.co.uk</managingEditor>\n";
	echo "       <webMaster>web@bailriggfm.co.uk</webMaster>\n";
	
//	for ($i = count($headlines)-1; $i >= 0; $i--) {
	for($i = 0; $i < 10; $i++) {		
		$current = fetchNewsArticle($headlines[$i][0]);
		echo "       <item>\n";
		echo "        <title>$current[3]</title>\n";
		echo "               <link>http://www.bailriggfm.co.uk/news/article.php?id={$headlines[$i][0]}</link>\n";
		$dateFormat = date('r',$current[2]);
		echo "               <pubDate>$dateFormat</pubDate>\n";
		echo "               <description>{$headlines[$i][2]}</description>\n";
		echo "       </item>\n";
		}
	echo "     </channel>\n";
	echo "</rss> ";

?>
