Jump to content
xisto Community
Sign in to follow this  

Using Php And Javascript To Manage Rss Feeds

Recommended Posts

This thread is not a real tutorial, but basically a brief method of manipulating RSS feeds using Javascript and PHP while avoiding the confusing parsing methods of EXPAT (which I find really annoying to learn, yet I still haven't finished learning it)

I know that many people are quite used to scripting in EXPAT to parse XML files, but to those who are not used to event-parsing method, I've come up with an alternative way. However, there are a few things you must know about Javascript and PHP/MySQL and XML.

For java script: XML DOM
For PHP/MySQL: Database to hold post
For XML: to make RSS feeds
So I just came up with this last night on the top of my head. This will be the first time I'm writing it down so bare with me.

Basically what you have to do is to parse the RSS feed using XML DOM. To create a new item for the RSS feed, you would insert a new row to the database using PHP and SQL. After that section of the PHP program, declare a variable that would hold the source code for the "updated RSS feed"


$rss = "<? xml version="1.0" ?> \n";$rss .= " <? rss version="2.0" ?> \n";

Basically that's what you would have to do. Please excuse the errors that might exist inside those values. I haven't written an XML in a while so I forgot what it was supposed to be like.

Now after the opening tags, you would insert the 6 most recent rows in the MySQL database. I prefer using 6 because isn't that the standard? I don't know maybe 15 but it can be any amount you want. Just don't make the file too big.

After you've done this, overwrite or create a new RSS file. And there you go.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.