<?php
header('Content-type: text/xml');
include "../includes/include_fns.php";
$conn = db_connect();
?>

<rss version="1.0">
<channel>
  <title>Masters of Harmony News</title> 
  <link>http://www.mastersofharmony.org/news/</link> 
  <description>The very best in Barbershop Chorus music!</description> 
  <copyright>Copyright <?php print $current_year = date("Y",time()); ?> Masters of Harmony, All Rights Reserved</copyright>
  <language>en-us</language> 
  <pubDate><?php print $now = date("r",time()); ?></pubDate>
  <lastBuildDate><?php print $now = date("r",time()); ?></lastBuildDate> 
  <docs>http://www.mastersofharmony.org/rss/docs.html</docs> 
  <managingEditor>editor@mastersofharmony.org</managingEditor> 
  <webMaster>webmaster@mastersofharmony.org</webMaster> 
  
<?php

   // ----------------------------------------------
   // Get the news stories from the database here...
   // ----------------------------------------------

   $news_sql = "select * from stories where page = 'news' and published is not null order by byline_date desc";
   $news_result = mysql_query($news_sql, $conn);
   $num_stories = mysql_num_rows($news_result);
   for ($i=1; $i <= 8; $i++) {
      $story = mysql_fetch_array($news_result);
      if ($num_stories > $i) {
?>

   <item>
   <title><?php print $story[headline]; ?></title>
   <link>http://www.mastersofharmony.org/view_article/index.php?id=<?php print $story[id]; ?></link>
   <description><?php print $story[headline]; ?></description>
   <pubDate><?php print date("r", $story[byline_date]); ?></pubDate>
   <guid>http://www.mastersofharmony.org/view_article/index.php?id=<?php print $story[id]; ?></guid>
   </item>

<?php
      }
   }
?>

</channel>
</rss>
