|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| 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. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
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>
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>
__________________
Benjamin Foley Web Development & Marketing http://www.bfoleyinteractive.com/ bfoley@bfoleyinteractive.com |
|
|||
|
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. |
|
|||
|
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:
|
|
|||
|
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 |
|
||||
|
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> "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 |
|
|||
|
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! |
|
|||
|
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:
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |