<?php 

require_once( $_SERVER['DOCUMENT_ROOT'] . "/php/ssl_off.php" );
require_once( $_SERVER['DOCUMENT_ROOT'] . "/Classes/Database.php" );
require_once( $_SERVER['DOCUMENT_ROOT'] . "/Classes/Article.php" );

echo("<?xml version='1.0'?>\n"); 

?>
<rss version="2.0">
  <channel>
    <title>Wilderness Supply - Blog On a Log</title>
    <link>http://www.wildernesssupply.ca/</link>
    <description>Follow Wilderness Supply's intrepid blogger as she shares her experiences and also asks some questions here, on the Blog on a Log.</description>
<?php

// query the SQL database for the last 5 blog entries
$query = "SELECT nID FROM t_articles WHERE sType = 'blog' AND bDisplay = '1' ORDER BY nID DESC LIMIT 0,5;";

$result = Database::query( $query );

while ( $row = Database::fetchRow( $result ) )
{
  try
  {
    $aArticle = Article::loadArticle( $row[0] );
?>
    <item>
       <title><?php echo(htmlentities($aArticle->getsTitle())); ?></title>
       <link>http://www.wildernesssupply.ca/display.php?nID=<?php echo($row[0]); ?></link>
       <description><?php echo(htmlentities($aArticle->getsShortDesc())); ?></description>
       <pubDate><?php echo(date( "r", strtotime( $aArticle->getdDateAdded() ) )); ?></pubDate>
    </item>

<?php
  }
  catch( Exception $e) {}
}

?>
  </channel>
</rss>
