I'm using Simplepie to parse different RSS feeds, passing them to a Smarty template, and I need to return the attribute from each item line that in this example reads: NEWSX
<source url="http://whatever.url/"><![CDATA[NEWSX]]></source>
I have found the get_item_tags method will select the line and attribute having used the following:
$newssource = $item->get_item_tags('','source');
Here is my problem. I don't know how to attach each source to an item when using the following code (so that basically I can display the different source element each time alongside the usual title, link, description and so on):
$RSS = array();
foreach($items as $item){
$feed = $item->get_feed();
$tmp=array();
$newssource = $item->get_item_tags('','source');
echo $newssource[0]["data"];
if ($feed){
if ($enclosure = $item->get_enclosure()){
$tmp['title'] = $item->get_title();
$tmp['permalink'] = $item->get_permalink();
$tmp['thumbnail'] = $enclosure->get_thumbnail();
$tmp['description'] = $enclosure->get_description();
$tmp['image'] = $enclosure->get_link();
}
$tmp['date'] = $item->get_date('j M Y');
$tmp['content'] = $item->get_content();
$tmp['title'] = $item->get_title();
$tmp['link'] = $item->get_link();
$tmp['description'] = $item->get_description();
array_push($RSS, $tmp);
}
}
Can it be done? Thanks in advance for any help or advice.