<? 
include('../global.php');
$compress_html = false;

//get data
$news  = new News();
$mysql = new MySQL();

$mysql->query("SELECT id FROM noticias ORDER BY data DESC LIMIT 5");

while ($row = mysql_fetch_array($mysql->result)) {
  $news->newsID($row[0]);
  $parsed_news[] = $news;
}
header ("Content-type: text/xml; charset=ISO-8859-1");    // Output file as XML
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; // The XML declaration

?>

<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:h="http://www.w3.org/1999/xhtml"
	xmlns:hr="http://www.w3.org/2000/08/w3c-synd/#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns="http://purl.org/rss/1.0/">

<channel rdf:about="http://hosting.kolorbit.com">
<title>www.kolorbit.com</title>
<description>
kolorbit.com - Hosting profissional
</description>
<link>http://hosting.kolorbit.com</link>
<items>
  <rdf:Seq>
<?
foreach ($parsed_news as $news) {
  echo '<rdf:li rdf:resource="http://hosting.kolorbit.com/noticias.php?id='.$news->id.'" />';
}
?>
  </rdf:Seq>
</items>
    
</channel>

<?
foreach ($parsed_news as $news) {

    echo '<item rdf:about="http://hosting.kolorbit.com/noticias.php?id='.$news->id.'">'.
         '<link>http://hosting.kolorbit.com/noticias.php?id='.$news->id.'</link>'.
         '<title>'.$news->titulo.'</title>'.
         '<description>'.htmlspecialchars(strip_tags(str_replace("<br />", "\n", $news->texto)), ENT_QUOTES, 'ISO-8859-1').'</description>'.
         '<dc:date>'.$news->date.'</dc:date>'.
         '</item>';
    echo "\n\n";
}
?>
</rdf:RDF>
