parse($cache);
$oldTop = $oldList->structure["items"][0];
$newList = new Jonah_headlines();
$newList->parse($fresh);
$newItems = array();
foreach ($newList->structure["items"] as $item)
{
if (isset($item['link']) && $item['link'] == $oldTop['link'])
break;
if (isset($item['description']) && $item['description'] == $oldTop['description'])
break;
// I guess if we're still here, it's not equal to the old top item:
$newItems[] = $item;
}
return $newItems;
}
function formatRSS ($url, $out)
{
$foo = new Jonah_headlines();
$foo->parse($url);
error_reporting(E_ALL);
//error_reporting(0);
if ($out == 'js')
$jsp = new jsprint();
else
$text = "";
if (!isset($foo->structure) ||
!isset($foo->structure["items"]) ||
!is_array($foo->structure["items"]) ||
count($foo->structure["items"]) <= 0 )
{
echo "Problem parsing $url
\n";
return;
}
foreach ($foo->structure["items"] as $item)
{
$tmp = "";
if (isset($item['link']))
$link = $item['link'];
if (isset($item['title']))
$title = $item['title'];
if (isset($item['description']))
$description = $item['description'];
if (!empty($link) && !empty($title) )
$tmp .= "" . $title . "";
$tmp .= "
\n";
if (!empty ($description))
$tmp .= $description . "
";
if (!empty($tmp) && $out == 'list')
$tmp = "