Adding Images to the RSS feed in K2 2.2


/ Published in: PHP
Save to your folder(s)

Credit goes to B. Kemler. I'm simply saving this for future reference.


Copy this code and paste it in your HTML
  1. Go to /components/com_k2/models/item.php line 368 and replace the Description section with this:
  2.  
  3. $item->feedimage='';
  4.  
  5. if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_S.jpg'))
  6. $item->feedimage = '<img align=left style=padding-right:5px; src='.JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg>';
  7.  
  8. if ($params->get('feedText')=='1'){
  9. $item->description=$item->feedimage.$item->fulltext;
  10. }
  11. else if ($params->get('feedText')=='2'){
  12. $item->description=$item->feedimage.$item->introtext.'<br/>'.$item->fulltext;
  13.  
  14. }
  15. else {
  16. $item->description=$item->feedimage.$item->introtext;
  17. }

URL: http://community.getk2.org/forum/topics/additional-details-for-the-k2?commentId=3536014%3AComment%3A19606

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.