• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I can't read RSS feed from 2 XML in one function.

#1
[eluser]Unknown[/eluser]
I try to read RSS like this web http://codeigniter.com/wiki/RSSParser but it can read from 1 xml only

This is my Controller
Code:
public function rss_news(){
//Load the shiny new rssparse
$this->load->library('RSSParser', array('url' => 'http://www.manager.co.th/RSS/Home/Breakingnews.xml', 'life' => 0));
//Get six items from the feed
$data = $this->rssparser->getFeed(10);

return $data;
}
public function rss_sport(){
//Load the shiny new rssparse
$this->load->library('RSSParser', array('url' => 'http://www.manager.co.th/rss/sport/sport.xml', 'life' => 0));
//Get six items from the feed
$data = $this->rssparser->getFeed(10);

return $data;
}

public function main_home()
{
$data['rss_news'] = $this->rss_news();
$data['rss_sport'] = $this->rss_sport();

$this->load->view('main_view',$data);
}

This is my View.
Code:
foreach ($rss_news as $item1)
{

echo $item1['title']."<br/>";
}

foreach ($rss_sport as $item2)
{

echo $item2['title']."<br/>";
}

but when I run this code it run function $data['rss_news'] = $this->rss_news(); 2 time.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.