getByUrl() 공개 정적인 메소드

Static method to create a Feed Reader object from a URL
public static getByUrl ( string $url, integer $limit, string $prefix = 'Pop\Feed\Format\' ) : Reader
$url string
$limit integer
$prefix string
리턴 Reader
예제 #1
0
 public function testSetAndGetDateFormat()
 {
     $feed = Feed\Reader::getByUrl('http://gdata.youtube.com/feeds/base/standardfeeds/most_viewed', 4);
     $feed->setDateFormat('m/d/Y');
     $this->assertEquals('m/d/Y', $feed->getDateFormat());
 }
예제 #2
0
<?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();
}