Posted By

vaughanj on 02/18/14


Tagged

rss atom zRSSFeed RSS2


Versions (?)

Limit RSS item content


 / Published in: jQuery
 

URL: http://forum.zazar.net/forum_posts.asp?TID=335

So, i did it in a simple way. I´ve decided to use ?feed=rss format. The reason: rss2 and atom brings the html tags into the content and i was breaking the HTML tags by cropping it using ".substring". The result was a corrupted / strange text in zRSSFeed Final Result.

So for feed=rss i did this way and it works!

$(document).ready(function () { $('#test').rssfeed('http://fast-forward.tv/blog/?feed=rss',{snippet: ''},function(e) {

      $('p',e).each(function(i) {

           var content = $(this).text();
           if (content.length >200) $(this).text(content.substring(0,200)+'...');
      });
 });

});

In order to use RSS2 and Atom it would be necessary to handle it in a proper way and avoid the html tags break.

  1. $(document).ready(function () {
  2. $('#test').rssfeed('http://fast-forward.tv/blog/?feed=rss',{snippet: ''},function(e) {
  3.  
  4. $('p',e).each(function(i) {
  5.  
  6. var content = $(this).text();
  7. if (content.length >200) $(this).text(content.substring(0,200)+'...');
  8. });
  9. });
  10. });

Report this snippet  

You need to login to post a comment.