CogDogBlog Alan Levine barks about and plays with stuff here

A quick update to the PHP script for the RSS to Javascript demo posted here May 7.

For a reminder, this is a strategy for incorporating RSS feeds into ANY web page (HTML, Blackboard, WebCT) via a reference to a single line of JavaScript code.

The mian improvements (suggested by Randy Brown) were to add URL parameter options:

  • to show/hide channel information
  • set a number of items to display
  • show/hide the item descriptions

I also changed the way the script accesses the variables to the $_GET array as some servers that have PHP security settings for globals=off may run into some trouble (this was a first attempt at addressing this issue; and I am not sure it takes care of the problem- see I am a hack programmer 😉

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

Comments

  1. I appreciate everyone’s efforts on this project. Now I have the enviable task of putting to use all of your work.

    But,alas, the enivitable baffling techno glitch.

    Can anyone help? I’ve installed but, no feed displayed when pointing to the script on our server. Now, when I point to the script on your server it’s fine.

    Test page http://www.nczoo.org/scripts/rss/

    Rob

  2. Sorry if is not as smooth as I lef you to believe.

    First of all, the syntax of your JavaScript is not correct you must have the src= followinf the question mark

    You have:

    src=http://www.nczoo.org/scripts/rss/rss2js.php?http://theregister.co.uk/feeds/latest.rdf

    and it should be:

    src=http://www.nczoo.org/scripts/rss/rss2js.php?src=http://theregister.co.uk/feeds/latest.rdf

    When doing the testing, you should start be just testing the url in your browser. e.g. paste in:

    http://www.nczoo.org/scripts/rss/rss2js.php?src=http://theregister.co.uk/feeds/latest.rdf

    Sometihng is not correct about your script or set up but I have no way (or time) to diagnose. As you noted, the feed works fine on ours:

    http://jade.mcli.dist.maricopa.edu/feed/rss2js.php?src=http://theregister.co.uk/feeds/latest.rdf

    Make sure you have correct settings for the paths to the Onyx library amd your cache location.

  3. Alan-

    Thanks for the pointers. I did as you suggested and I’m now able to see the error condition by opening the feed from my browser, downloading and reviewing it.

    The error is:

    “Could not open the specified file. Check the path, and make sure that you have write permissions to this file.”

    I am checking with our webhost on write permissions as I am certain I now have the correct path.

  4. In your download package I would suggest editing line #87 of the rss2js.php to point correctly to the onyx function as it is unzipped.

    I know it’s pretty basic but, this may save some PHP newbies (like me) some pain.

    Thanks again.

  5. Thanks Rob, I had forgotten to remove the paths I use on my server, and needed to uncomment the default ones for the download package. It is corrected now in the download ZIP

  6. Pingback: cogdogblog

Comments are closed.

Blog Pile

RSS to JS examples+code

To follow up on the RSS in Blackboard piece, I have posted a new page that documents and demos RSS to JS along with the source PHP code.
(more…)

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

Comments

  1. I downloaded the zip file and put it in my web site directory in a folder called “feed”. Then I set the web page code to

    Doesn’t work. Maybe it is rocket science.

    Rick Bateman

  2. You should first make sure your web site host supports PHP.

    Then you should test your PHP script by executing it as a URL in your web browser, e.g., the site you attempted, works on my script:

    http://jade.mcli.dist.maricopa.edu/feed/rss2js.php?src=http://infotechvi.com/news.xml

    Finally, in the code you sent me:

    <script language=”JavaScript” src=”rss2js.php?

    src=http://infotechvi.com/news.xml“> </script>

    will only work if you call it from a web page in the same directory as your PHP script, ideally you would issue a FULL url that points to your script:

    <script language=”JavaScript” src=”http://www.somesite.com/feed/rss2js.php?

    src=http://infotechvi.com/news.xml“> </script>

    This is experimental, free, so some leg work is going to be on your end.

  3. Well, I tried everything and everything is as you say it should be but it still only works when I use the http://jade.mcli.dist.maricopa.edu URL so it must be something else about my ISP’s server config. I even tried the FTP permissions.

    I was mainly interested in this to share it with my local RSS group but it does not seem to be as “no brainer portable” as I hoped.

    Thanks anyway.

  4. I am guessing Rick, your issue is with PHP global settings being OFF on your server, and the way I had written the code did not address this.

    I have made an update of the code (blogged) to try and take care of this, as well as add some display options mentioned by Randy Brown.

    See:

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

  5. Pingback: Object Learning
  6. Pingback: carvingCode
  7. Pingback: cogdogblog

Comments are closed.

Powered by WordPress and Cover modded by @cogdog