 |

10-08-2004, 02:41 PM
|
 |
WebProWorld Member
|
|
Join Date: Dec 2003
Location: Sunnyvale, Ca, USA
Posts: 30
|
|
Javascript + RSS + RSS = ?
Greetings Everyone, Im not a javascript wizard nor have i ever wanted to be. However im working on a little somethin somethin that i could use some advise/direction/help.
What im trying to do:
--------------------------------------------
Franchising.com Highlights:
* Subject 1
* Subject 2
* Subject 3
--------------------------------------------
Area Developer Highlights:
* Subject 1
* Subject 2
* Subject 3
--------------------------------------------
Where:
Franchising.com = http://www.franchising.com/franchising.xml
and
Area Developer = http://www.areadeveloper.us/rss.xml
Heres what I currently have:
Code:
<script language="JavaScript">
var arrADTitle = new Array(), arrADLink = new Array();
function loadAreaDeveloper(url, handler) {
if (document.implementation && document.implementation.createDocument) {
var xmldoc = document.implementation.createDocument("", "", null);
xmldoc.onload = function( ) { handler(xmldoc); }
xmldoc.load(url);
}
else if (window.ActiveXObject) {
var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.onreadystatechange = function( ) {
if (xmldoc.readyState == 4) handler(xmldoc);
}
xmldoc.load(url);
}
}
function formatADRSS(xmldoc) {
var items = xmldoc.getElementsByTagName("item");
for(var i = 0; i < items.length; i++) {
var e = items[i];
arrADTitle[i] = e.getElementsByTagName("title")[0].firstChild.data;
arrADLink[i] = e.getElementsByTagName("link")[0].firstChild.data;
}
showNewsReel();
}
function showNewsReel(){
var strNewsReel = "" ;
for(var idx = 0; idx < arrADTitle.length; idx++ ) {
strNewsReel = strNewsReel + '»' + arrADTitle[idx] + '
';
}
areadeveloper.innerHTML = strNewsReel;
}
</script>
</head>
<body onLoad="loadAreaDeveloper('http://www.areadeveloper.us/rss.xml',formatADRSS);">
<span id="areadeveloper"></span>
and
Code:
<script language="JavaScript">
var arrFTitle = new Array(), arrFLink = new Array();
function loadFranchising(url, handler) {
if (document.implementation && document.implementation.createDocument) {
var xmldoc = document.implementation.createDocument("", "", null);
xmldoc.onload = function( ) { handler(xmldoc); }
xmldoc.load(url);
}
else if (window.ActiveXObject) {
var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.onreadystatechange = function( ) {
if (xmldoc.readyState == 4) handler(xmldoc);
}
xmldoc.load(url);
}
}
function formatRSS(xmldoc) {
var items = xmldoc.getElementsByTagName("item");
for(var i = 0; i < items.length; i++) {
var e = items[i];
arrFTitle[i] = e.getElementsByTagName("title")[0].firstChild.data;
arrFLink[i] = e.getElementsByTagName("link")[0].firstChild.data;
}
showNewsReel();
}
function showNewsReel(){
var strNewsReel = "" ;
for(var idx = 0; idx < arrFTitle.length; idx++ ) {
strNewsReel = strNewsReel + '»' + arrFTitle[idx] + '
';
}
franchising.innerHTML = strNewsReel;
}
</script>
<body onLoad="loadFranchising('http://www.franchising.com/franchising.xml',formatRSS);">
<span id="franchising"></span>
Now for the challenge. Both work separatly but not together. How can i make this script work with 2 separate RSS'. I want them both to display in different areas on the same page. Ive tried duplicating the script and trying to run it as 2 separate include files and that didnt work. Any ideas would be greatful.[/code]
|

10-08-2004, 10:42 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Aug 2003
Location: Edmonton, AB, Canada
Posts: 3,406
|
|
You have the same function defined in both scripts, I think that is a big problem:
function showNewsReel()
Here is what I use, there is a php and javascript solution to display multiple feeds on a page:
http://www.geckotribe.com/rss/
I only had yo instal the parser, one folder - I think I just uploaded it and made one configuration in a config file, then it is just a matter of plugging in the feed url into a php include(in my case):
<?php
require_once "relative_path/carp/carp.php";
CarpCacheShow('http://feeds.dshield.org/news.xml');
?>
You have to name the page witha php extention if you use this, but their javascript will work on any extention, of course.
__________________
What I am is what I am, are you what you are, or what.
Eddie Brickel
|

10-08-2004, 10:49 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Aug 2003
Location: Edmonton, AB, Canada
Posts: 3,406
|
|
You can generate javascript for each feed here:
http://p3k.org/rss/?setup=true
actually, this one looks pretty good, you can configure the look and number of headlines etc.
It is open source = free!
here is a blurb from their page:
Quote:
About JavaScript RSS box viewer:
This RSS box viewer can display the formats RSS 0.91, RSS 0.92, RSS 1.0 (w/o modules), RSS 2.0 and Scripting News 2. (Sorry, no Atom.) It provides a simple way to embed such RSS boxes in any HTML document via a generated JavaScript tag.
|
__________________
What I am is what I am, are you what you are, or what.
Eddie Brickel
|

10-12-2004, 03:20 PM
|
 |
WebProWorld Member
|
|
Join Date: Dec 2003
Location: Sunnyvale, Ca, USA
Posts: 30
|
|
Syndication and Security Errors.
as seen in my previous post i am working on a Javascript applet that will allow the village idiot to use our RSS Feeds through a simple 1 line string of code.
Code:
<script language="JavaScript" src="http://bfoley.areadeveloper.us/areadeveloper.js" type="text/javascript"></script>
When Attempting to load this in any page i get:
"This page is accessing information tht is not under its control. This poses a security risk. Do you wish to continue"
In IE and absolutly nothing in Opera. Here is the contents of areadeveloper.js
Code:
var arrADTitle = new Array(), arrADLink = new Array();
function loadAreaDeveloper(url, handler) {
if (document.implementation && document.implementation.createDocument) {
var xmldoc = document.implementation.createDocument("", "", null);
xmldoc.onload = function( ) { handler(xmldoc); }
xmldoc.load(url);
}
else if (window.ActiveXObject) {
var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.onreadystatechange = function( ) {
if (xmldoc.readyState == 4) handler(xmldoc);
}
xmldoc.load(url);
}
}
function formatADRSS(xmldoc) {
var items = xmldoc.getElementsByTagName("item");
for(var i = 0; i < items.length; i++) {
var e = items[i];
arrADTitle[i] = e.getElementsByTagName("title")[0].firstChild.data;
arrADLink[i] = e.getElementsByTagName("link")[0].firstChild.data;
}
showADNewsReel();
}
function showADNewsReel(){
var strNewsReel = "<table border=0 cellpadding=1 cellspacing=0 width=150 bgcolor=888888><tr><td><img src=http://bfoley.areadeveloper.us/images/areadeveloper_rss.gif width=150 height=41 alt='Area Developer Magazine' border=0>
<table border=0 cellpadding=5 cellspacing=0 width=100% bgcolor=EEEEEE><tr><td background='http://bfoley.areadeveloper.us/images/nav_bg.gif'>" ;
var endNewsReel = "</td></tr></table></td></tr></table>" ;
for(var idx = 0; idx < arrADTitle.length; idx++ ) {
strNewsReel = strNewsReel + '<table width=100% cellpadding=2 cellspacing=0><tr><td valign=top><b style="font-family: tahoma, geneva, futura; font-size: 10px; color: 999999;">»[/b]</td><td>' + arrADTitle[idx] + '
</td></tr></table>';
}
areadeveloper.innerHTML = strNewsReel + endNewsReel;
}
loadAreaDeveloper('http://bfoley.areadeveloper.us/rss3.xml',formatADRSS);
document.write("<span id='areadeveloper'></span>")
Again I am a javascript hack at best. Trying to learn and figuring out slowly so be gental ;).
|

10-12-2004, 11:58 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Aug 2003
Location: Edmonton, AB, Canada
Posts: 3,406
|
|
Ahhhh.
This is a security issue with the browser. I have mine set to 'access data across domains' but not script.
The javascript must be getting some script on the other end? I am no expert myself, but that may be what is going on. I try ro use php feed code for my pages so never noticed this.
I have gotten similar warnings sometimes, and wondered what they were!
__________________
What I am is what I am, are you what you are, or what.
Eddie Brickel
|

02-05-2006, 05:33 AM
|
|
WebProWorld New Member
|
|
Join Date: Feb 2006
Posts: 1
|
|
Re: Javascript + RSS + RSS = ?
Thanks for your guide!
I just used the second code and place inside my page. It seems O.K when I view it from my computer but it false when I upload and view from my web server. It said error with access denied! My web site is http://vietnam.mpage.jp/index.htm. But I found that have another site that displays this well, here it is http://weblog.iprodev.net/uploadedfiles/rss_dmea.htm.
So please tell me what is my mistake. I am sorry because I just begin learning web design and I am sorry for my bad English!
If you can, please email me at sodegaurashi@yahoo.co.jp
Thank you!
Quote:
|
Originally Posted by ofoglada
Greetings Everyone, Im not a javascript wizard nor have i ever wanted to be. However im working on a little somethin somethin that i could use some advise/direction/help.
What im trying to do:
--------------------------------------------
Franchising.com Highlights:
* Subject 1
* Subject 2
* Subject 3
--------------------------------------------
Area Developer Highlights:
* Subject 1
* Subject 2
* Subject 3
--------------------------------------------
Where:
Franchising.com = http://www.franchising.com/franchising.xml
and
Area Developer = http://www.areadeveloper.us/rss.xml
Heres what I currently have:
Code:
<script language="JavaScript">
var arrADTitle = new Array(), arrADLink = new Array();
function loadAreaDeveloper(url, handler) {
if (document.implementation && document.implementation.createDocument) {
var xmldoc = document.implementation.createDocument("", "", null);
xmldoc.onload = function( ) { handler(xmldoc); }
xmldoc.load(url);
}
else if (window.ActiveXObject) {
var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.onreadystatechange = function( ) {
if (xmldoc.readyState == 4) handler(xmldoc);
}
xmldoc.load(url);
}
}
function formatADRSS(xmldoc) {
var items = xmldoc.getElementsByTagName("item");
for(var i = 0; i < items.length; i++) {
var e = items[i];
arrADTitle[i] = e.getElementsByTagName("title")[0].firstChild.data;
arrADLink[i] = e.getElementsByTagName("link")[0].firstChild.data;
}
showNewsReel();
}
function showNewsReel(){
var strNewsReel = "" ;
for(var idx = 0; idx < arrADTitle.length; idx++ ) {
strNewsReel = strNewsReel + '»' + arrADTitle[idx] + '
';
}
areadeveloper.innerHTML = strNewsReel;
}
</script>
</head>
<body onLoad="loadAreaDeveloper('http://www.areadeveloper.us/rss.xml',formatADRSS);">
<span id="areadeveloper"></span>
and
Code:
<script language="JavaScript">
var arrFTitle = new Array(), arrFLink = new Array();
function loadFranchising(url, handler) {
if (document.implementation && document.implementation.createDocument) {
var xmldoc = document.implementation.createDocument("", "", null);
xmldoc.onload = function( ) { handler(xmldoc); }
xmldoc.load(url);
}
else if (window.ActiveXObject) {
var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.onreadystatechange = function( ) {
if (xmldoc.readyState == 4) handler(xmldoc);
}
xmldoc.load(url);
}
}
function formatRSS(xmldoc) {
var items = xmldoc.getElementsByTagName("item");
for(var i = 0; i < items.length; i++) {
var e = items[i];
arrFTitle[i] = e.getElementsByTagName("title")[0].firstChild.data;
arrFLink[i] = e.getElementsByTagName("link")[0].firstChild.data;
}
showNewsReel();
}
function showNewsReel(){
var strNewsReel = "" ;
for(var idx = 0; idx < arrFTitle.length; idx++ ) {
strNewsReel = strNewsReel + '»' + arrFTitle[idx] + '
';
}
franchising.innerHTML = strNewsReel;
}
</script>
<body onLoad="loadFranchising('http://www.franchising.com/franchising.xml',formatRSS);">
<span id="franchising"></span>
Now for the challenge. Both work separatly but not together. How can i make this script work with 2 separate RSS'. I want them both to display in different areas on the same page. Ive tried duplicating the script and trying to run it as 2 separate include files and that didnt work. Any ideas would be greatful.[/code]
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|