From an RSS feed, using SimplePie I'm trying to access the value of the additional element 'source' using 'get_item_tags', and then use this alongside the usual title, description and so on for each item to be displayed in a news page using a smarty template.
Problem is that I can't access and convert 'news_source' into an item, instead of using the echo method as stated in the simplepie documentation. When adding as $tmp['news_source'] nothing is being returned. Code snippet follows:
$RSS = array();
foreach($items as $item){
$feed = $item->get_feed();
$tmp=array();
$news_source = $item->get_item_tags('','source');
/*
echo $news_source[0]["data"];
*/
if ($feed){
$tmp['date'] = $item->get_date('j M Y, g:i a');
$tmp['content'] = $item->get_content();
$tmp['title'] = $item->get_title();
$tmp['link'] = $item->get_link();
$tmp['description'] = $item->get_description();
$tmp['news_source'] = $item->$get_news_source();
array_push($RSS, $tmp);
}
}
$smarty->assign( $params['assign'], $RSS );
Then in the smarty template, the output:
<div class="cont">
<a href="{$entry.link}" target="_new">{$entry.title}</a><br>
<span class="date">Published on: <strong>{$entry.date}</strong></span>
<span class="source">Via : <strong>{$entry.news_source}</strong></span><br />
</div>
Thanks for any help or advice.