本文整理汇总了PHP中RSSFeed::feedContent方法的典型用法代码示例。如果您正苦于以下问题:PHP RSSFeed::feedContent方法的具体用法?PHP RSSFeed::feedContent怎么用?PHP RSSFeed::feedContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSSFeed
的用法示例。
在下文中一共展示了RSSFeed::feedContent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRenderWithTemplate
public function testRenderWithTemplate()
{
$rssFeed = new RSSFeed(new ArrayList(), "", "", "");
$rssFeed->setTemplate('RSSFeedTest');
$content = $rssFeed->feedContent();
$this->assertContains('<title>Test Custom Template</title>', $content);
$rssFeed->setTemplate('RSSFeed');
$content = $rssFeed->feedContent();
$this->assertNotContains('<title>Test Custom Template</title>', $content);
}
示例2: testRSSFeed
function testRSSFeed()
{
$list = new DataObjectSet();
$list->push(new RSSFeedTest_ItemA());
$list->push(new RSSFeedTest_ItemB());
$list->push(new RSSFeedTest_ItemC());
$origServer = $_SERVER;
$_SERVER['HTTP_HOST'] = 'www.example.org';
Director::setBaseURL('/');
$rssFeed = new RSSFeed($list, "http://www.example.com", "Test RSS Feed", "Test RSS Feed Description");
$content = $rssFeed->feedContent();
//Debug::message($content);
$this->assertContains('<link>http://www.example.org/item-a/</link>', $content);
$this->assertContains('<link>http://www.example.com/item-b.html</link>', $content);
$this->assertContains('<link>http://www.example.com/item-c.html</link>', $content);
$this->assertContains('<title>ItemA</title>', $content);
$this->assertContains('<title>ItemB</title>', $content);
$this->assertContains('<title>ItemC</title>', $content);
$this->assertContains('<description>ItemA Content</description>', $content);
$this->assertContains('<description>ItemB Content</description>', $content);
$this->assertContains('<description>ItemC Content</description>', $content);
// Feed #2 - put Content() into <title> and AltContent() into <description>
$rssFeed = new RSSFeed($list, "http://www.example.com", "Test RSS Feed", "Test RSS Feed Description", "Content", "AltContent");
$content = $rssFeed->feedContent();
$this->assertContains('<title>ItemA Content</title>', $content);
$this->assertContains('<title>ItemB Content</title>', $content);
$this->assertContains('<title>ItemC Content</title>', $content);
$this->assertContains('<description>ItemA AltContent</description>', $content);
$this->assertContains('<description>ItemB AltContent</description>', $content);
$this->assertContains('<description>ItemC AltContent</description>', $content);
Director::setBaseURL(null);
$_SERVER = $origServer;
}