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

Simple Pie with Silverstripe

Go to End

4 Posts   2018 Views


Community Member, 60 Posts

19 January 2011 at 2:56am

Edited: 19/01/2011 4:03am

Hey All. I've been using this tutorial to create an RSS aggregator on a site I'm working on.

I have the following code above the doctype in one off my .ss tamplates pages:


    //get the simplepie library
    //grab the feed
    $feed = new SimplePie();

    //enable caching
    //provide the caching folder
    //set the amount of seconds you want to cache the feed
    //init the process
    //let simplepie handle the content type (atom, RSS...)


I have the file in the assets folder and a cache directory with full writeable permissions, but unfortunately I'm getting the followng error:

Parse error: syntax error, unexpected T_REQUIRE_ONCE in /tmp/silverstripe-cache-home-isslcom1-public_html/ on line 9

Would really appreciate any help.


Community Member, 60 Posts

19 January 2011 at 4:01am

OK I've realised that the template files can't process the php from directly within the template file and I would need to call this php code from the php file for that specific page type.

I have no idea how to do this though. Can someone point me in the right direction?


Forum Moderator, 5523 Posts

20 January 2011 at 9:12pm

Yes all PHP code should be in your PHP file!

For a start make a new custom page type (as the tutorials explain) then you can make a custom function which returns a set of all your entries. See for a simple example.

You can also use RestfulService for this sort of work -


Community Member, 60 Posts

21 January 2011 at 12:52am

Thanks Willr. I really appreciate your response.