This is my first publicy released WordPress Plugin/Widget. This plugin reads a Writely RSS Feed and display the items in a Widget on your sidebar. It’s based entirley on the RSS Feed Widget that comes with the WordPress Widgets Control but instead of just displaying the feed items I have modified it to remove the Introduction and Private items.
How It Works:
The Writely RSS Feed Widget will display a list of links of documents from Writely. If a user is either the owner or a collaborator they will see the document in edit mode other wise they will see the document in a read-only view mode.
Read the rest of this entry »
updated: aug 7, 2006 - fixed code error added hack for 2 side-bars
Summary
While browsing Theme Viewer looking for a cool theme that I could hack up I found theme that was tagged as “Widget ready”. “Humm what’s a widget?”, I asked my self.
A widget is? The creator of WordPress Widgets says this:
“Widgets” is just a silly buzzword we’ve chosen for this sidebar-chopping plug-in we have developed. They could have been called Gadgets or Gizmos or Wizbangs or Whatevers. On the surface, they’re just things you can use to personalize your WordPress site without knowing HTML. Way down deep, they may be something entirely more significant.
That’s cool but what if I don’t like any one of the 54 Widget ready themes? Can I use my own theme and hack this into it?
This ran on ScratchProjects.com for the article contest back in August2006.
Description: This HOWTO will explain how to extend Building an Ajax & PHP RSS Reader using AjaxAgent Part 1 to include No-Refresh/No-Post-Back Form operations, database interaction as well as auto-complete functions that demonstrate some advanced Ajax/PHP operations. The end result will be an RSS Feed Reader that contains the typical Create, Read, Update and Delete database operations but using Ajax to perform these tasks.
Note
Before diving in I must point out the PHP/MySQL code is not optimized for performance and the application contains NO SECURITY features what-so-ever. Also there are much better RSS Feed Readers out there but my intention is to show you some cool stuff you can do with Ajax, PHP and databases.
Setting Things Up
In Part 1 we learned how to consume some hard-coded RSS feeds and display them in a webpage. This will still be our end result but instead of having the URL's hard-coded we are going to gather them from a database.
Before we get started you'll need to:
1. Create a MySQL Database (or some place to add a new table)
2. Create a new table named Feeds
Once you've got the DB set up create the db connection file: dbconn.inc.php
PHP:
Agent Feeder Table Structure

SQL:
--
-- Table structure for table 'Feeds'
--
Now that that's all set here's what we're going to do:
1. Create a Feed in the DB using a Ajax Enabled Form
2. Read all of the feeds to populate a list
3. Select a feed to read the RSS data
4. Update an existing feed using a Ajax Enabled Form
5. Delete an existing feed using a Ajax Enabled Form
Each step is a 3 part process: 1) HTML, PHP and Ajax.
This ran on ScratchProjects.com for the article contest back in July 2006.
Description: This HOWTO will explain how to build an RSS Feed Reader using AjaxAgent and PHP that can read the latest posts from multiple Wordpress Blogs.
1. RSS Feed Reader using Ajax and PHP Part 1
Introduction
In this HOWTO I will explain how to build an RSS Feed Reader using AjaxAgent and PHP that can read the latest posts from multiple Wordpress Blogs.
I have my own domain name of gotfoo.org and since I tend to write about many subjects I felt that it was important to use sub-domains to seperate the content. I did this in the style of slashdot.org so I have linux.gotfoo.org and you.gotfoo.org. This setup works fine but I still want to just give out the root domain gotfoo.org for any shameless plugs and what not.
For my "homepage" I wanted to have a the latest posts with a link directly to the content but I did not want to have to hack Wordpress and make a database call or anything. Instead I wanted to hook into the existing RSS feed that is provided by the WP framework.
To start with I created an index.php in my root directory which would serve as the entry point to gotfoo.org and a subfolder named ajaxrss where I placed the ajaxagent RSS file:
* agent.php
* rss.php
* footer.php
* rss_cache.inc
* rss_fetch.inc
* rss_parse.inc
* rss_utils.inc
I haven't inspected all of these files but they work fine so I will focus on the 2 you need to be concerned about.
The agent.php is the main file for ajaxagent where all of the magic happens. This file can be anywhere on your server if you are using more than one of it functions.
The second file rss.php is where you are going to send the URL Feed to be processed.
The function rss get the url and then replaces any white space with "+" to make it url friendly and then it invokes fetch_rss with the url and returns a php list with the rss data, the stats, and any messages. Next it creates an string variable that will contain the rss feed as formatted html. It then creates the $title and $link variables and populates them with the corresponding rss data. Once it has some data it creates a link to the channel it got the rss feed from and inserts the link into the html, then it loops over each item in the the rss feed and adds it as a list-item link. Once it reaches the end of the loop it return the formatted html string back to the calling function.
Here is rss.php w/o comments:
You shouldn't need to alter the rss.php file to get this working but if you want to include any other rss data like the description of each feed item or the date you would add it to the foreach loop.
For example if we wanted to include the description of each feed item we would add this $html .= $item[description]; to the foreach loop:
To get all of this working all you need to do is add the includes for rss.php and agent.php and the initilize the ajaxagent:
The add some JavaScript which calls the call_rss and the callback_rss functions and then I create a window.onload function that invokes call_rss w/ a URL to the rss feed:
In my Wordpress set up I am using permalink so all of my posts show up as a directory and not a file name or linux.gotfoo.org/?p=123.
Then add a DIV to place RSS Feed results in:
and that's it.
It is important to note that the data is bound to the controls via the ID's. So you'll need to be sure that the DIV you are populating is named div_rss.
Now when the page loads it fetches the first 10 posts from linux.gotfoo.org and you.gotfoo.org.
This can easily be used to fetch posts from any RSS feed not just from Wordpress...