RSS2JS Script Fix

In response to observed, unexpected behavior, I made a minor tweak to our PHP script that does the RSS to JS magic, using JavaScript to embed RSS content in any page.

The probllem was on the simple way I was naming my cache files (the RSS parser I use creates cache files to ease the load on your server)- previously it based the cache file on just the path and file name of the RSS feed, so in some cases people were getting feeds from other sites (bad).

Now cache files are based on the entire URL, as to make them unique. The change would not likely affect someone running our PHP script to generate feeds from their own sites- it is more of a problem like ours, where when I cleaned the cache directory, I saw nearly 500 cache files.

Your mileage may vary.

Creative Commons License
The RSS2JS Script Fix by CogDogBlog, unless otherwise expressly stated, is licensed under a Creative Commons Attribution 3.0 United States License.

6 Responses to “RSS2JS Script Fix”

  1. ALIEN says:

    Hello,

    Nice script. It works beautifully. However, i’m using RSSv2.0 and im having problems adjusting the code from $dc_date to use . Is there any chance you can improve compatibility issues? At the moment its not parsing the date correctly and showing 1970 as the date.

    Thank you, keep up the great work.

  2. Richard says:

    Alan, I was emailing this link to a fella and noticed the update. Thanks!

    We need an email list to be notifed of updates! :)

    You’ve created a monster!

    Thanks again

    Richard

  3. Richard says:

    Alan, back again, updated scripts work great,

    FYI:

    “rss2js.php script” has been updated but the “Version History” hadn’t … confusing

    Also, as to the date comment above, I’m using V2.0 also and the justed tested, the date comes thru fine. I wonder if his feed validates?

    Thanks again

    Peace

    Richard

  4. Alan Levine says:

    “Alien” was correct, my code was not properly handling the RSS 2.0 feeds, but I just posted a fix:

    http://jade.mcli.dist.maricopa.edu/alan/archives/000241.html

    or test it at:

    http://jade.mcli.dist.maricopa.edu/feed/

    The problem was the code looking at itme tags was not lookign for pubDate (now it does)- and as I discovered, it would not get the URLs linked because it was not looking for the <guid> tags.

    Richard,

    I have seen a few MovableType feeds billed as RSS 2.0 but they actually are not using pubDate.

  5. Alan Levine says:

    PS for Richard-

    No emails for updates, but you can tune your RSS reader to:

    http://jade.mcli.dist.maricopa.edu/alan/cat_rss.rdf

  6. cogdogblog says:

    More Fixes for RSS2JS

    Wow, once you start tinkering with code, the worm can opens up. I made a few more adjustments to the RSS to JS demo due to the worminess of RSS 2.0 versus 1.0. After comments in yesterday’s announced fix, I…

Recent Barks and Howls: