<?php require_once '../../bootstrap.php'; use Pop\Feed; try { $tmpl = <<<POSTS <div class="post-div"> <a href="[{link}]">[{title}]</a><br /> <strong>[{published}]</strong> ([{time}])<br /> </div> POSTS; $facebook = Feed\Reader::getByAccountName('facebook', 'highvoltagenola', 3); $facebook->setTemplate($tmpl); echo '<h1>' . $facebook->title . '</h1>' . PHP_EOL; echo '<h4>' . $facebook->likes . ' Likes</h4>' . PHP_EOL; $facebook->render(); } catch (\Exception $e) { echo $e->getMessage(); }
<?php require_once '../../bootstrap.php'; use Pop\Feed\Reader; try { $tmpl = <<<VIDEOS <div class="video-div"> <a href="[{link}]"><img src="[{image_thumb}]" alt="[{title}]" border="0" /></a><br /> <a href="[{link}]">[{title}]</a><br /> <strong>[{published}]</strong> ([{time}])<br /> [{likes}] Likes<br /><br /> </div> VIDEOS; $feed = Reader::getByUrl('http://gdata.youtube.com/feeds/base/standardfeeds/most_viewed', 3); $feed->setTemplate($tmpl); $feed->render(); } catch (\Exception $e) { echo $e->getMessage(); }
public function testRssRender() { $tmpl = <<<NEWS <div class="news-div"> <a href="[{link}]">[{title}]</a><br /> <strong>[{published}]</strong> ([{time}])<br /> <p>[{description}]</p> </div> NEWS; $feed = new Feed\Reader(new Feed\Format\Rss('http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&topic=h&output=rss', 4)); $feed->setTemplate($tmpl); $this->assertContains('Google', $feed->title); $code = $feed->render(true); ob_start(); $feed->render(); $output = ob_get_clean(); ob_start(); echo $feed; $echoOutput = ob_get_clean(); $this->assertContains('<div class="news-div">', $code); $this->assertContains('<div class="news-div">', $output); $this->assertContains('<div class="news-div">', $echoOutput); }
<?php require_once '../../bootstrap.php'; use Pop\Feed; try { $tmpl = <<<POSTS <div class="post-div"> <a href="[{link}]">[{title}]</a><br /> <strong>[{published}]</strong> ([{time}])<br /> </div> POSTS; $twitter = Feed\Reader::getByAccountName('twitter', 'highvoltagenola', 3); //$twitter = new Feed\Reader(new Feed\Format\Rss\Twitter(array('name' => 'highvoltagenola'), 3)); $twitter->setTemplate($tmpl); echo '<h1>' . $twitter->title . '</h1>' . PHP_EOL; echo '<h4>' . $twitter->tweets . ' Tweets : ' . $twitter->following . ' Following : ' . $twitter->followers . ' Followers</h4>' . PHP_EOL; $twitter->render(); } catch (\Exception $e) { echo $e->getMessage(); }