[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.