Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Tutorial 2 - RSS Feeds

Go to End

2 Posts   1227 Views


Community Member, 50 Posts

25 February 2009 at 5:32pm

Have completed the section concerning adding a RSS feed to the News page. I have faithfully followed the tutorial withou making any modifications. The RSS icon lights up on the news page but when I select the option I get the following error message.

Invalid xml declaration.
Line: 2 Character: 3

<?xml version="1.0"?>

Can anyone help?

James Bolitho

Community Member, 33 Posts

18 June 2009 at 8:20am

I have run into the same problem. After some searching of the forum I found a crude fix posted by another member which solves the problem by adding the following line at 189 to sapphire/api/RSSfeed.php:

$body=str_replace("<?xml version=\"1.0\"?>","",$body);
echo $body;

Original post by bruceb can be viewed here

The root of the problem appears to be being caused by a space being inserted into the top of the page html code before the Doc type declaration. I have swapped between the tutorial and Black Candy Theme but it seems to be the same in both. I have looked in the template files and in the class files for spaces but it all looks fine to me.

Has anyone got any ideas to what could be causing this? Any ideas are welcomed...