<?
$feedName = "Newsletter List";
$feedDesc = "This is a list of all Boxpilot Newsletters.";
$feedURL = "http://news.boxpilot.com/index.php";
$feedBaseURL = "http://news.boxpilot.com/"; // must end in trailing forward slash (/).
$allowed_ext = ".html";
?><<?= '?'; ?>xml version="1.0"<?= '?'; ?>>
<rss version="2.0">
<channel>
<title><?=$feedName?></title>
<link><?=$feedURL?></link>
<description><?=$feedDesc?></description>
<?
$files = array();
$dir=opendir("./");
while(($file = readdir($dir)) !== false)
{
$path_info = pathinfo($file);
$ext = strtoupper($path_info['extension']);
if($file !== '.' && $file !== '..' && !is_dir($file) && strpos($allowed_ext, $ext)>0)
{
$files[]['name'] = $file;
$files[]['timestamp'] = filemtime($file);
}
}
closedir($dir);
// natcasesort($files); - we will use dates and times to sort the list.
for($i=0; $i<count($files); $i++) {
if($files[$i] != "index.php") {
echo "<li><a href=\"".$files[$i]."\">" . substr($files[$i], 0, strrpos($files[$i], ".")) . "</a></li>\n";
echo " <item>\n";
echo " <title>". $files[$i]['name'] ."</title>\n";
echo " <link>". $feedBaseURL . $files[$i]['name'] . "</link>\n";
echo " <pubDate>". date("D M j G:i:s T Y", $files[$i]['timestamp']) ."</pubDate>\n";
echo " </item>\n";
}
}
?>
</channel>
</rss>