I have a small issue which I'm hoping someone can help me resolve.
Copied below is a piece of code which goes away to my database model and returns an array with a URL and a feed type. The user enters whether they have used a twitter name, blogger site etc.
However, to parse this data with simplepie I need to pass an array of URL's... and I lose my "type" option. Is there anyway I could add this back to the simplepie item so that I can display a specific icon if the user has selected a specific type of feed.
$feed = $this->profile_model->get_module_feed();
$feedarr = array();
foreach($feed['data'] as $feeds) {
if ($feeds['type'] == 1 ) {
$i = "http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=" . $feeds['rss'];
}
if ($feeds['type'] == 2 ) {
$i = "http://search.twitter.com/search.atom?q=" . $feeds['rss'];
}
if ($feeds['type'] >= 3 ) {
$i = $feeds['rss'];
}
$d = $feeds['type'];
//else $i = $feeds['rss'];
echo $i . " " . $d . "<br />";
array_push($feedarr, $i);
}
$this->simplepie->set_feed_url($feedarr);
$this->simplepie->enable_cache(false);
$this->simplepie->init();
$this->simplepie->handle_content_type();
$data = $this->simplepie;
foreach($data->get_items() as $item) { ?>
<h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
<p><?php echo $item->get_description(); ?></p>
<p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
<?php
}
}
}
?>
Eg, if the $feed['type'] is 1 I would like to display the image associated with 1
hoping someone can help as I'm a wee bit stumped!