-
RSS Feed javascript
Does anyone know if there is a way to get this script to show the entire feed including images?
Code:
<head>
<script type="text/javascript" src="http://www.google.com/jsapi?key=MYKEY"></script>
<script type="text/javascript">
google.load("feeds", "1");
function initialize() {
var feed = new google.feeds.Feed("http://thedosblogger.blogspot.com/atom.xml");
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("feed");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var div = document.createElement("div");
div.appendChild(document.createTextNode(entry.title));
container.appendChild(div);
}
}
});
}
google.setOnLoadCallback(initialize);
</script>
</head>
<body>
<div id="feed"></div>
</body>
-
Well the best thing to do would be to read the Google Feeds documentation...
http://code.google.com/apis/ajaxfeed...reference.html
Code:
function initialize() {
var feed = new google.feeds.Feed("http://thedosblogger.blogspot.com/atom.xml");
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("feed");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var div = document.createElement("div");
var content=document.createElement("div");
content.innerHTML=entry.content
div.appendChild(content);
container.appendChild(div);
}
}
});
}
-
It did and I tried a lot of things, but most of it was greek to me
Thank you for your help rdoyle720
-
Hmmm... How do I add title and publishedDate to that? Now it only shows content.
I looked at another script example and there it shows
Code:
var attributes = ["title", "content", "publishedDate"];
Is there a way to add that to the script?
-
Yep, each item is an entry, and it's showing the content by getting entry.content. So to get the title, you'd get entry.title and entry.publishedDate.
Code:
function initialize() {
var feed = new google.feeds.Feed("http://thedosblogger.blogspot.com/atom.xml");
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("feed");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var div = document.createElement("div");
var content=document.createElement("div");
content.innerHTML=entry.title+"<br>"+entry.publishedDate+"<br>"+entry.content
div.appendChild(content);
container.appendChild(div);
}
}
});
}
-
Aha! I think I'm starting to understand and it's wasn't as hard as I thought it was. All I neded was to add ""+ +""
Thank you so much rdoyle720. You have really helped me out
Been working on this problem since yesterday
-
Can anyone explane to me how it comes that it only shows the first four entries? It doesn't show the entire rss feed. That was kinda strange
-
From the page linked above: "By default, the FeedControl class loads 4 entries from each feed." It's likely for performance so it doesn't load a billion entries.
Code:
function initialize() {
var feed = new google.feeds.Feed("http://thedosblogger.blogspot.com/atom.xml");
feed.setNumEntries(10); // change this number to whatever you want
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("feed");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var div = document.createElement("div");
var content=document.createElement("div");
content.innerHTML=entry.title+"<br>"+entry.publishedDate+"<br>"+entry.content
div.appendChild(content);
container.appendChild(div);
}
}
});
}
-
You're a genius rdoyle720
-
webpage to help me create a ticker style rss feed that keeps flicking through the feeds. It uses Javascript. If you know a bit about both ... pass a little html in the description. your feeds are rss 2.0.... old as far as standards..
Thanks
Mangerpola
_______________________
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|