3

I wanted to ask, I have a div that I would want to place RSS feeds from the BBC or CNN. Now that works but I wanted to paginate the feeds that come in, display 5 at a time with the others showing when the links are clicked.

I am starting to write the code now but I was hoping I would get either inspiration or have an example I could glean from.

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
Joseph Izang
  • 766
  • 1
  • 13
  • 43

2 Answers2

0

Take a look at SimplePie RSS class and CodeIgniter, also check SimplePie Plugins and Integration and SimplePie CodeIgniter Library, study more and learn it by yourself.

Nathan Campos
  • 28,769
  • 59
  • 194
  • 300
0

I've used Haughin's Simple CodeIgniter Library. It's very simple to use.

$this->load->library('simplepie');
$this->simplepie->set_feed_url('http://feeds.haughin.com/haughin');
$this->simplepie->set_cache_location(APPPATH.'cache/rss');
$this->simplepie->init();
$this->simplepie->handle_content_type();

$data['rss_items'] = $this->simplepie->get_items();

echo "<li>";
foreach($rss_items as $item) {
    echo "<li>";
    echo "<a href='" .$item->get_link() . "'>";
    echo $item->get_title();
    echo "</a>";
    echo "</li>";
}
echo "</li>";

You can check out the code here.

Teej
  • 12,764
  • 9
  • 72
  • 93
  • Does anyone know how to take the value of $item->get_title() and add it to a variable? It sounds simple but I all I get is: "Fatal error: Cannot use object of type SimplePie_Item as array in /home/seedetai/public_html/testseedetail/application/models/post_model.php on line 162". – Adamantus Apr 23 '12 at 08:35