WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-08-2004, 02:41 PM
ofoglada's Avatar
WebProWorld Member
 

Join Date: Dec 2003
Location: Sunnyvale, Ca, USA
Posts: 30
ofoglada RepRank 0
Default 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]
__________________
Benjamin Foley
Web Development & Marketing
http://www.bfoleyinteractive.com/
bfoley@bfoleyinteractive.com
Reply With Quote
  #2 (permalink)  
Old 10-08-2004, 10:42 PM
mikmik's Avatar
WebProWorld 1,000+ Club
 

Join Date: Aug 2003
Location: Edmonton, AB, Canada
Posts: 3,406
mikmik RepRank 1
Default

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
Reply With Quote
  #3 (permalink)  
Old 10-08-2004, 10:49 PM
mikmik's Avatar
WebProWorld 1,000+ Club
 

Join Date: Aug 2003
Location: Edmonton, AB, Canada
Posts: 3,406
mikmik RepRank 1
Default

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
Reply With Quote
  #4 (permalink)  
Old 10-09-2004, 10:26 AM
WebProWorld New Member
 

Join Date: Sep 2004
Posts: 7
notepage RepRank 0
Default RSS and Java

You can use Feed2JS to create the script it will also allow you to customize it - http://jade.mcli.dist.maricopa.edu/f...ex.php?s=build

HTH
__________________
Sharon Housley
NotePage, Inc. - http://www.notepage.net
FeedForAll - http://www.feedforall.com
Reply With Quote
  #5 (permalink)  
Old 10-12-2004, 03:20 PM
ofoglada's Avatar
WebProWorld Member
 

Join Date: Dec 2003
Location: Sunnyvale, Ca, USA
Posts: 30
ofoglada RepRank 0
Default 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 ;).
__________________
Benjamin Foley
Web Development & Marketing
http://www.bfoleyinteractive.com/
bfoley@bfoleyinteractive.com
Reply With Quote
  #6 (permalink)  
Old 10-12-2004, 11:58 PM
mikmik's Avatar
WebProWorld 1,000+ Club
 

Join Date: Aug 2003
Location: Edmonton, AB, Canada
Posts: 3,406
mikmik RepRank 1
Default

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
Reply With Quote
  #7 (permalink)  
Old 02-05-2006, 05:33 AM
WebProWorld New Member
 

Join Date: Feb 2006
Posts: 1
Nippon RepRank 0
Default 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]
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0