Visit Our Home Page
 Explored,Designed,Delivered.sm
Welcome, Guest. Please Login or Register (Password Reminder)


Creativyst Forums 
Support & Discussion 
Register Help Search Login  
   
   Creativyst Forums-TOP
   Web Site Design
   Basic Javascript to display RSS feed in html
(Moderator: admin)
 Author
Topic: Basic Javascript to display RSS feed in html       [Link=199]
Reply Please log in first.
mgshilling
New Member


Posts: 3





Gender:
     
    Basic Javascript to display RSS feed in html   (Date posted: 06/23/07 at 06:00:39) Quote Modify Delete

I need some help with some Javascript. I am trying to use javascript to parse a RSS feed and place it in a <span> using very basic style. I have tried to find an rss feed reader on the web, but they all utilize external code and/or use other languages. Worst of all they aren't very easy to customize. I've read several books, webpages and forums. So far the closest thing I have found is script that JRepici and Stevo came up with. Topic: horizontal duplication? 25

Can you help me out?
All I need it to do is read a standard RSS feed:



Mainly it should just read the <item>, <title>, <Link> and <Description> tags, but still have the other tags availble in case someone feels they need to subscribe to the feed (its mainly going to be used to simplify my site design. so I don't have to recode 20 some pages for every instance). Eventually I will make it an external .js file.

I have tried to understnd and adapt the code JRepici created for Stevo, but can only get it to read a basic xml file not an rss file.



I have been experimenting and tinkering off site (almost a gig of of test.html and sample.xml files in a folder on my computer and a novel of printed 8.5" X 11" pages with pencil notes and scratches)

A sample of what I actually have (that works) is here :
www.oardc.ohio-state.edu/police/pages/temp.htm

Though I am asking for code I really am hoping to learn how it works.

Thank you for anything you can show and teach me.



"I don't have any plans to quit my night job to start programming... at least not until they make me stop carrying a gun"
-Me

To paraphrase the old Jim Croce song, You don't tug on Superman's cape, you don't spit into the wind, and you don't taunt the guy who has the immediate capacity and authority to shoot your sorry butt."

  WWW  E-Mail   Ip: Logged
JRepici
Administrator


Posts: 328





Gender:
      JohnRHere2
    Re: Basic Javascript to display RSS feed in html   (Date posted: 08/13/07 at 10:20:14) Quote Modify Delete

mgshilling,

Hi.

The technique discussed in those threads was from an old article here about data-binding using I.E.'s data islands. The article includes some examples, including an example of reading an RSS feed using these techniques.

BUT...

First there is the usual caveat for this stuff: Data-binding techniques as they are used here work ONLY in I.E. If people prefer other browsers and even other operating systems they will not be able to view data you include in your pages using data-binding. For example, I prefer Firefox and had to start I.E. special in order to view your page as it was meant to be viewed (I will now need to preemptively reboot my computer, run full virus and spy-ware scans, and take a hot shower ).

Second, it has been a while since I've used anything about data-binding. For displaying feed data on this site I have been using my own Javascript convention called JSMsg. But that requires that you convert RSS feeds to JSMsg feeds so that they can be displayed in your visitor's browsers. This means you would have to install and run a free script available here at the site called JSMFeed. It is a perl script, and not everybody has enough access in their hosting account to run it.

. . .
I came up with JSMsg to address the same problem you are now struggling with. In a perfect world, it should not require server-side scripting to simply display an information-feed (like RSS) on a web-page.

After JSMsg, a new JavaScript capability came along called AJAX (specifically a new Javascript function called XMLHttpRequest() which lets you read in outside DOM documents using your script). It is still needlessly complex (as are most "standards" produced by the W3C these days), but it should work. I say "should" because I'm still using JSMsg in my requirements and can't vouch for the new way.

Third, You can use a third party service to produce a Javascript conversion of a given RSS feed. Find this option discussed at this thread.

Fourth, I usually mention my own pet-peeve about this issue. Right now the standard says you can include a style-sheet (or similar structure) from within an XML data document. The standard doesn't take the one tiny extra logical step and allow XML data documents to be included from within style-sheets (etc.). If the W3C would simply codify the reverse of their XML "include" convention, permitting people to include an XML data document from within a style sheet. None of this absurd complexity would be necessary.

Sorry about talking your eyes off.

-djr

   E-Mail   Ip: Logged
mgshilling
New Member


Posts: 3





Gender:
     
    Re: Basic Javascript to display RSS feed in html   (Date posted: 06/29/07 at 04:56:54) Quote Modify Delete

Thank you for your reply. Maybe I will need to look into perl script and JSMsg. I will have enough here to keep me busy for a while.

I know explorer has it's issues but most of the people out there are using it. It's a catch 22. 90% of my target audience use IE and have no clue that there are alternative browsers out there.



"I don't have any plans to quit my night job to start programming... at least not until they make me stop carrying a gun"
-Me

To paraphrase the old Jim Croce song, You don't tug on Superman's cape, you don't spit into the wind, and you don't taunt the guy who has the immediate capacity and authority to shoot your sorry butt."

  WWW  E-Mail   Ip: Logged
JRepici
Administrator


Posts: 328





Gender:
      JohnRHere2
    Re: Basic Javascript to display RSS feed in html   (Date posted: 06/29/07 at 11:01:40) Quote Modify Delete

mgshilling,

Hi again.

I may have come off a little hard on Microsoft and I.E. there. I.E. has its issues, though it probably has more to do with it being the overwhelmingly biggest target on the range, than bad development. I don't personally know for sure, and I don't think it's even possible to know for sure.

That said, it seems best to produce web pages that anybody can use (I.E. AND alternatives) just because, well, variety is the spice of life.

Let me know how you're doing with whatever solution you decide on.

-djr

   E-Mail   Ip: Logged
mgshilling
New Member


Posts: 3





Gender:
     
    Re: Basic Javascript to display RSS feed in html   (Date posted: 08/12/07 at 03:44:14) Quote Modify Delete

Its been awhile.
I'm still studying. I'll let you know when I update my web page.

No need to reply.



"I don't have any plans to quit my night job to start programming... at least not until they make me stop carrying a gun"
-Me

To paraphrase the old Jim Croce song, You don't tug on Superman's cape, you don't spit into the wind, and you don't taunt the guy who has the immediate capacity and authority to shoot your sorry butt."

  WWW  E-Mail   Ip: Logged
Reply Please log in first.
Pages: 1
Jump to:

YaBB Board c 2000
YaBB Programming Team
 



















© Copyright 2002 - 2008 Creativyst, Inc.