2010-12-05 90 views
2

我需要一些帮助,我的RSS阅读器脚本... 我想缩略图从RSS订阅缩略图采取获取缩略图从RSS提要,并显示在列表视图

"content": [ 
     { 
     "medium": "image", 
     "url": "http://www......de/wp-content/uploads/2010/11/sgroth_web.jpg", 
     "title": { 
     "type": "html", 
     "content": "sgroth_web" 
     }, 
     "description": { 
     "type": "html", 
     "content": "contenthere 4." 
     }, 
     "thumbnail": { 
     "url": "http://www.sdddd.de/wp-content/uploads/2010/11/sgroth_web-150x150.jpg" 
     } 

看看我是什么意思我的列表视图: Preview

首先是缩略图,然后将RSS提要的冠军。 本规范是jQuery和PHP ...

这里是我要显示RssFeeds代码,我ñJS:

$(function(){ 


getOnlineFeed('http://salzstreuner.de/category/aktuelle_ausgabe/feed'); 
    }); 
/* functions */ 
var listEntries = function(json) { 
    if (!json.responseData.feed.entries) return false; 
    $('#widgetTitle').text(json.responseData.feed.title); 
    var articleLength =json.responseData.feed.entries.length; 
    articleLength = (articleLength > maxLength) ? maxLength : articleLength; 
    for (var i = 1; i <= articleLength ; i++) { 
    var entry = json.responseData.feed.entries[i-1]; 
    $('#link' + i).text(entry.title); 
    $('#articleHeader' + i).text(entry.title); 
    $('#openButton' + i).attr('href', entry.link); 
    $('#articleContent' + i).append(entry.content); 
$('#articleImage').append('<img src="' + entry.thumbnail + '">'); 
    } 
    $('#article1 .prevButton').remove(); 
    $('#article' + articleLength + ' .nextButton').remove(); 
    if (articleLength < maxLength) { 
    for (i = articleLength + 1; i <= maxLength; i++) { 
     $('#list' + i).remove(); 
     $('#article' + i).remove(); 
    } 
    } 
}; 
var getOnlineFeed = function(url) { 
    var script = document.createElement('script'); 
    script.setAttribute('src', 'http://ajax.googleapis.com/ajax/services/feed/load?callback=listEntries&hl=ja&output=json-in-script&q=' 
         + encodeURIComponent(url) 
         + '&v=1.0&num=' + maxLength); 
    script.setAttribute('type', 'text/javascript'); 
    document.documentElement.firstChild.appendChild(script); 
}; 
var getOfflineFeed = function(url) { 
    var script = document.createElement('script'); 
    script.setAttribute('src', url); 
    script.setAttribute('type', 'text/javascript'); 
    document.documentElement.firstChild.appendChild(script); 
}; 

输出如下:

for(var i=1; i<=maxLength; i++){ 
    document.write(
    '<li id="list' + i + '"><img src="#articleImage"/><a href="#article' + i + '" id="link' + i + '">&nbsp;</a></li>' 
); 

我已经打了#articleImage,但它不工作。我希望有人能外帮我这littleBig问题...

THX MAsterluke

+0

那么什么是问题是什么呢?它应该做什么,它没有做什么?我看了预览版,看起来对我来说很好(FF 3.6)。 – matthewpavkov 2010-12-05 23:48:30

回答

0

,您应该使用thumbnailurl

('#articleImage').append('<img src="' + entry.thumbnail.url + '">');