środa, 17 sierpnia 2011

LastRSS enclosure tag fix!

Hi there, if you use LastRSS library and want to show images from RSS Channel you need to update your Last RSS library with my code. There is a bug in standard LastRSS library code.

First find:

foreach($this->itemtags as $itemtag) {
$temp = $this->my_preg_match("'<$itemtag.*?>(.*?)'si", $rss_item);
if ($temp != '') $result['items'][$i][$itemtag] = $temp; // Set only if not empty
}

After this foreach you need to insert this code:

// enclosure fix
$temp = $this->my_preg_match("'
if ($temp != '') $result['items'][$i]['enclosure'] = $temp; // Set only if not empty
// end enclosure fix


Now you have enclosure elem in item array with URL to image ;)


Have fun

1 komentarz:

Unknown pisze...

Hi,

Like that ?

foreach($this->itemtags as $itemtag) {
$temp = $this->my_preg_match("'<$itemtag.*?>(.*?)'si", $rss_item);
if ($temp != '') $result['items'][$i][$itemtag] = $temp; // Set only if not empty
}

// enclosure fix
$temp = $this->my_preg_match("'<$itemtag.*?>(.*?)'si", $rss_item);
if ($temp != '') $result['items'][$i]['enclosure'] = $temp; // Set only if not empty
// end enclosure fix

Thanks