Jump to:

23364 Posts in 18125 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » RSS advice

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

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

Page: 1
Go to End
Author Topic: 717 Views
  • MiloFinlay
    Avatar
    Community Member
    2 Posts

    RSS advice Link to this post

    Hi there,

    I have added the below code to display a RSS feed on my football.php page. I called the function "CustomRSSFeed()" on the football.ss and it did not run.....

    class Football_Controller extends Page_Controller {

    function CustomRSSFeed() {
    $feed = new SimplePie("http://newsrss.bbc.co.uk/rss/sportonline_world_edition/football/rss.xml");
    $feed->feed->init();
    $output = new DataObjectSet();
    if($items = $feed->feed->get_items(0, 10)) {
    foreach($items as $item) {
    $output->push(new ArrayData(array(
    "Title" => $item->get_title(),
    "Link" => $item->get_link()
    )));
    }
    }
    return $output;
    }

    }

    Am I going about this the right way? Any help or advice would be grateful as I am still getting my head around this style of programming.

    Cheers,
    Miles

  • banal
    Avatar
    Community Member
    901 Posts

    Re: RSS advice Link to this post

    Hi Miles

    I guess this wiki page should help: http://doc.silverstripe.com/doku.php?id=rssfeed

  • MiloFinlay
    Avatar
    Community Member
    2 Posts

    Re: RSS advice Link to this post

    Hey it did thanks! Also found this link.....

    http://www.silverstripe.org/archive/show/89#post943

    717 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.