/**
     * testRender method
     */
    public function testRender()
    {
        $item = new JFeedItem(array('title' => 'Joomla!', 'link' => 'http://www.joomla.org', 'description' => 'Joomla main site', 'author' => 'Joomla', 'authorEmail' => '*****@*****.**', 'category' => 'CMS', 'comments' => 'No comment', 'guid' => 'joomla', 'date' => 'Mon, 20 Jan 03 18:05:41 +0400', 'source' => 'http://www.joomla.org'));
        $this->object->addItem($item);
        $this->assertThat(preg_replace('#\\t\\t<lastBuildDate>[^<]*</lastBuildDate>\\n#', '', $this->object->render()), $this->equalTo('<?xml version="1.0" encoding="utf-8"?>
<!-- generator="Joomla! 1.6 - Open Source Content Management" -->
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title></title>
		<description></description>
		<link>http://localhost</link>
		<generator>Joomla! 1.6 - Open Source Content Management</generator>
		<atom:link rel="self" type="application/rss+xml" href="http://localhost/index.php?format=feed&amp;type=rss"/>
		<language>en-gb</language>
		<item>
			<title>Joomla!</title>
			<link>http://www.joomla.org</link>
			<guid isPermaLink="false">joomla</guid>
			<description><![CDATA[Joomla main site]]></description>
			<author>joomla@joomla.org (Joomla)</author>
			<category>CMS</category>
			<comments>No comment</comments>
			<pubDate>Mon, 20 Jan 2003 14:05:41 +0000</pubDate>
		</item>
	</channel>
</rss>
'), 'Line:' . __LINE__ . ' The feed does not generate properly.');
    }
Ejemplo n.º 2
0
$feedDoc->syndicationURL = 'http://www.autrynationalcenter.org';
$feedDoc->copyright = 'Copyright (C) Autry National Center';
$feedDoc->editor = 'Autry National Center';
$feedDoc->title = 'Autry National Center Schedule of Events';
//$feedDoc->subtitle = 'Feed sub title';
foreach ($this->events as $day) {
    foreach ($day['schedules'] as $event) {
        $sitename = substr_replace(JURI::base(), "", -1);
        if ($event->scope == 'Exhibition') {
            $time = date("M j, Y", $event->startTime);
            $link = JRoute::_('index.php?option=com_ccevents&scope=exbt&task=detail&oid=' . $event->oid);
            $title = $time . " " . $event->genre . ": " . $event->title;
        } else {
            $time = date("M j, Y g:iA", $event->startTime);
            $link = JRoute::_('index.php?option=com_ccevents&scope=prgm&task=detail&fid=' . $event->fid . '&oid=' . $event->oid);
            $title = $time . " " . $event->genre . ": " . $event->title;
        }
        $item = new JFeedItem();
        $item->title = $title;
        $item->link = $link;
        $item->description = $event->getSummary();
        $item->date = date("r", $event->startTime);
        $item->category = $event->genre;
        $feedDoc->addItem($item);
    }
}
require_once JPATH_SITE . DS . 'libraries' . DS . 'joomla' . DS . 'document' . DS . 'renderer.php';
require_once JPATH_SITE . DS . 'libraries' . DS . 'joomla' . DS . 'document' . DS . 'feed' . DS . 'renderer' . DS . 'rss.php';
$renderer = new JDocumentRendererRSS($feedDoc);
echo $renderer->render();