Skip to content

Instantly share code, notes, and snippets.

@MWins
Last active January 25, 2017 02:27
Show Gist options
  • Save MWins/ff775059803ac7625933 to your computer and use it in GitHub Desktop.
Save MWins/ff775059803ac7625933 to your computer and use it in GitHub Desktop.
RSS-add-feed-to-site

Using PHP and RSS to update two pages and add news items at one location.

RSS (is this still a viable option?)

Yes.

You would have to learn some php scripting. What you are wanting is the ability to add items to an RSS feed. Let's say you create an RSS feed and put it in the web_root as feed.php. Both pages pull the RSS feed and display it. How you pull it is up to you. There's javascript/jquery for this available on the web. Figure this approach will be best since it doesn't require converting pages to php (or changing server configuration to parse html as php, which is an option).

Here's a javascript class for reading RSS feeds. This should be part one, grab an existing feed and use a test page to display the feed. It's important to understand how to limit the # of items shown.

http://www.zazar.net/developers/jquery/zrssfeed/

Next thing you need to do is get familiar with RSS feeds. Specifically how to write one manually. You can use this class for PHP to see how to write one out : https://github.com/miquelcamps/PHP-RSS-Class

Here's the hard part... create a file called edit_rss.php. It defaults to a form with the required fields for the RSS feed item. Title,content, etc. Write routines to process the form submission, add those to the existing RSS feed, save the RSS file.

Then it's put everything into place. To skip requiring authenication, you can upload the edit_rss.php when you need to make edits/additions. And remove it when done.

Easy enough right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment