[eluser]karloff[/eluser]
I'm trying to create a library to load my feeds so i only have one lin in my controller (i'm using a template to to do most of the hard work). Before i had loaded a library which pulled the feeds, but i had to send the data to the view in every controller.
Is it possible to load the data and pass it to the cntroller so i would only have one line of code
here is the library thang i got....
Code:
<?
class Feeds {
function get_feeds()
{
$CI =& get_instance();
$CI->load->library('simplepie');
$CI->simplepie->set_feed_url('http://feeds.delicious.com/rss/username');
$CI->simplepie->init();
$CI->load->library('lastfm');
$config = array(
'user' => 'username',
'num' => 5,
'rss_cache_path' => APPPATH.'cache/lastfm-rss-cache',
'cache_time' => 300 // 5 minutes
);
$CI->lastfm->init($config);
$CI->lastfm->get_latest();
$CI->load->library('flickr');
$config = array(
'type' => 'user',
'user' => 'username',
'num_items' => 8,
'rss_cache_path' => APPPATH.'cache/flickr-rss-cache',
'cache_time' => 3600,
'img_cache_path' => APPPATH.'cache/flickr-image-cache',
'img_cache_url' => $CI->config->item('base_url').'application/cache/flickr-image-cache',
'use_cache' => false,
'image_size' => 'square'
);
$CI->flickr->init($config);
$CI->flickr->get_photos();
return $feeds;
}
}
?>
can anyone enlighten me on how I can then pass this through the controller to the view? Or a better way of doing it?