public function getpostsAction() { $request = $this->getRequest(); $order = $request->getParam('order'); $tag = $request->getParam('tag'); $name = $request->getParam('name'); $user_id = get_user_id(); $user_ids = array(); $user_ids[] = $user_id; $follow_mapper = new Application_Model_FollowMapper(); $friends = $follow_mapper->findAllByColumn('follower_id', $user_id); if (!empty($friends)) { foreach ($friends as $friend) { $user_ids[] = $friend['followed_id']; } } $post_mapper = new Application_Model_PostMapper(); $posts_ids = $post_mapper->getPosts($user_ids, $tag, $name, $order); $xml_text = '<?xml version="1.0" encoding="UTF-8"?>'; $xml_text .= '<posts>'; foreach ($posts_ids as $post_id) { $xml_text .= '<post>' . "http://plus.local/post/postxml/id/" . $post_id . "</post>"; } $xml_text .= '</posts>'; header("Content-type: text/xml"); $xml = new SimpleXMLElement($xml_text); echo $xml->asXML(); exit; }