-
Graham Cole authored
stop things breaking horribly if no planet atom.xml is present (e.g. with clean checkouts of the site)
Graham Cole authoredstop things breaking horribly if no planet atom.xml is present (e.g. with clean checkouts of the site)
planetposts.php 755 B
<?php
// number of recent planet entries we want to return
$num_entries = 5;
unset($result);
$planetposts = array();
$xmldata = @file_get_contents("../htdocs/planet/atom.xml");
if (!$xmldata) {
trigger_error("No planet atom.xml data loaded", E_USER_WARNING);
return;
}
$simplexml = simplexml_load_string($xmldata);
$xml = $simplexml->children('http://www.w3.org/2005/Atom');
foreach ($xml->entry as $entry) {
$planetposts[] = array(
"post" => $entry->title,
"post_uri" => $entry->link->attributes()->href,
"user" => $entry->author->name,
"user_uri" => $entry->author->uri
);
}
$planetposts = array_slice($planetposts, 0, $num_entries);
$smarty->assign('planetposts', $planetposts);
$result = $smarty->fetch('planetposts.tpl');
?>