Code: Select all
global $gCms;
$db = $gCms->db;
$show = 6;
$rss = "http://www.ruralfocus.co.uk/index.php?option=com_rss&feed=RSS0.91&no_html=1";
$handle = fopen ($rss, 'r');
$all = '';
if ($handle) {
while (!feof($handle)) {
$s = fgets($handle, 4096);
$all .= $s;
}
fclose($handle);
} else {
echo "error opening file";
}
for ($i=1;$i<=$show;$i++) {
$pos = strpos ($all, '<item>');
$all = substr ($all, $pos);
$pos = strpos ($all, '<title>');
$all = substr ($all, $pos+7);
$pos = strpos ($all, '</title>');
$title = substr ($all, 0, $pos);
$pos = strpos ($all, '<link>');
$all = substr ($all, $pos+6);
$pos = strpos ($all, '</link>');
$link = substr ($all, 0, $pos);
$pos = strpos ($all, '<pubDate>');
$all = substr ($all, $pos+9);
$pos = strpos ($all, '</pubDate>');
$date = substr ($all, 0, $pos);
$date=strtotime($date);
$date = date("j M Y", $date);
$pos = strpos ($all, '<description>');
$all = substr ($all, $pos+13);
$pos = strpos ($all, '</description>');
$description = substr ($all, 0, $pos);
echo "<p><a href=\"$link\" class=\"bluelink\" target=\"_blank\"><h4>$title</h4></a><span class=\"date\">$date</span><br />$description</p>";
}
