<?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"); $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'); ?>