function feedItem(feedTitle, feedLink, feedDescription, itemTitle, itemLink, itemPubDate,itemDescription, itemGuid ) { this.feedTitle = feedTitle; this.feedLink = feedLink; this.feedDescription = feedDescription; this.itemTitle = itemTitle; this.itemLink = itemLink; this.itemPubDate = itemPubDate; this.itemDescription = itemDescription; this.itemGuid = itemGuid; } function ASfeedItem(feedTitle, feedLink, feedDescription, itemTitle, itemLink, itemPubDate,itemDescription, itemGuid, itemCategory ) { this.feedTitle = feedTitle; this.feedLink = feedLink; this.feedDescription = feedDescription; this.itemTitle = itemTitle; this.itemLink = itemLink; this.itemPubDate = itemPubDate; this.itemDescription = itemDescription; this.itemGuid = itemGuid; this.itemCategory = itemCategory; } function getLatestRSSFeeds(number, rssfeed, div_id, itemtitle, itempubdate, itemdescription ){ jQuery.get('/includes/rss/rssfunction.php', {rssfeed:rssfeed, nbitems:number}, function(response) { /* We make use of the eval function, which converts the properly formatted string from the server into a javascript object */ rss2json = eval('('+ response +')'); jsonfeeds = new Array(); for(var i = 0; i < number; i++) { jsonfeeds[i] = new feedItem(rss2json.channel.channel.title, rss2json.channel.channel.link, rss2json.channel.channel.description, rss2json.channel.channel.item[i].title, rss2json.channel.channel.item[i].link, rss2json.channel.channel.item[i].pubDate, rss2json.channel.channel.item[i].description, rss2json.channel.channel.item[i].guid ); } formatJsonFeeds(number, div_id, itemtitle, itempubdate, itemdescription); }); } function getLatestASRSSFeeds(number, rssfeed, div_id, itemtitle, itempubdate, itemdescription ){ jQuery.get('/includes/rss/rssfunction.php', {rssfeed:rssfeed, nbitems:number}, function(response) { /* We make use of the eval function, which converts the properly formatted string from the server into a javascript object */ rss2json = eval('('+ response +')'); asjsonfeeds = new Array(); var j = 0; for(var i = 0; ;i++) { var pattern = rss2json.channel.channel.item[i].link; if (pattern.indexOf('Itemid=31') != -1 | pattern.indexOf('Itemid=32') != -1 | pattern.indexOf('Itemid=34') != -1 ) { if (pattern.indexOf('Itemid=31') != -1) { category = "Politics"; } else if (pattern.indexOf('Itemid=32') != -1) { category = "Economics/Business"; } else if (pattern.indexOf('Itemid=34') != -1) { category = "Culture"; } category = " (" + category + ")"; asjsonfeeds[j] = new ASfeedItem(rss2json.channel.channel.title, rss2json.channel.channel.link, rss2json.channel.channel.description, rss2json.channel.channel.item[i].title, rss2json.channel.channel.item[i].link, rss2json.channel.channel.item[i].pubDate, rss2json.channel.channel.item[i].description, rss2json.channel.channel.item[i].guid, category ); j++; } if (j == number) { break; } } formatJsonASFeeds(asjsonfeeds, div_id, itemtitle, itempubdate, itemdescription); }); } function formatJsonFeeds(number, div_id, itemtitle, itempubdate, itemdescription) { var str = ''; str += '