Dear all,
I have stumbled over the same problem as described in this thread on this forum but the advise given there did not work for me. So basically, having implemented rss functionality following the steps in the tutorial, I ran into the same problem with the following output. I've looked for whitespace creating lines, but could not find any. Your help is much appreciated. Best regards, zehjot.
My ArticleHolder.php looks like this. There are no whitespaces in the file before or after the <? and ?> tags.
<?php
/**
* Defines the ArticleHolder page type
*/
class ArticleHolder extends Page {
static $db = array(
);
static $has_one = array(
);
static $icon = "themes/tutorial/images/treeicons/news";
static $allowed_children = array('ArticlePage');
}
class ArticleHolder_Controller extends Page_Controller {
function rss() {
$rss = new RSSFeed($this->Children(), $this->Link(), "The coolest news around");
$rss->outputToBrowser();
}
function init() {
RSSFeed::linkToFeed($this->Link() . "rss");
parent::init();
}
}
?>
#########################Output:
[Warning] Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\silverstripe\mysite\code\ArticleHolder.php:1)
GET /silverstripe/nachrichten/rss
Line 188 in C:\xampp\htdocs\silverstripe\sapphire\api\RSSFeed.php
Source
179 HTTP::register_modification_timestamp($this->lastModified);
180 header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $this->lastModified) . ' GMT');
181 }
182 if(!empty($this->etag)) {
183 HTTP::register_etag($this->etag);
184 }
185
186 $body = $this->feedContent();
187 HTTP::add_cache_headers();
188 header("Content-type: text/xml");
189 echo $body;
190 }
191
192 /**
193 * Return the content of the RSS feed
194 */
Trace
* header(Content-type: text/xml)
Line 188 of RSSFeed.php
* RSSFeed->outputToBrowser()
Line 18 of ArticleHolder.php
* ArticleHolder_Controller->rss(HTTPRequest)
Line 162 of Controller.php
* Controller->handleAction(HTTPRequest)
Line 129 of RequestHandler.php
* RequestHandler->handleRequest(HTTPRequest)
Line 122 of Controller.php
* Controller->handleRequest(HTTPRequest)
Line 29 of ModelAsController.php
* ModelAsController->handleRequest(HTTPRequest)
Line 277 of Director.php
* Director::handleRequest(HTTPRequest,Session)
Line 121 of Director.php
* Director::direct(/nachrichten/rss)
Line 118 of main.php