Blog Portability Using mySQL

The term “blog portability” usually implies RSS. The PHP behind most blog software makes it easy to produce a RSS feed from the same mySQL content that is used to generate HTML pages. RSS can be an incredibly convenient standard, since RSS readers for the desktop and web-based content management systems are readily available. Commonly accepted standards are also good for scalability. But what if your site is small, and RSS is not the most convenient standard?

I recently created a channel to live blog content into our EMU (electronic message unit) system, which is based on PERL scripts and server-side includes. This adds new blog content to the end of our announcements list on the insideUHS home page. To do this using RSS, I would have to find a PERL module that could read RSS feeds (more difficult since PHP took over the web scripting world) and configure it to pull blog content into this page. However, since the home page and the blogs are hosted on the web server, I found a more direct solution. Thanks to the straightforward design of the Nucleus database, it was actually easier to pull blog content directly using mySQL queries.

This solution is significantly more flexible and efficient than the typical RSS feed plug-in. First, there is one less script involved. A RSS plug-in would send a request to the blog PHP script, which would then query its own database and return the result. Instead, my PERL script directly queries the mySQL database. Second, I only query the information I need — blog name, item title, and item number in this case. A RSS feed would also pull the blog content and author. I can add other options, such as including some blogs but not others and limiting the query to new posts from within the last three days. I am not limited to the options in the RSS plug-in. Finally, I can pull content from both private and public blogs, since they are all on the same server. Authentication is required only if you want to read the blog post.

Here is the query:

nucleus_item.`iblog`=nucleus_blog.`bnumber` AND
nucleus_item.`itime`>='$sqldate' AND
nucleus_item.`iblog`='100' OR

Once I convert all of our programs to blogs, then any new content a program director posts will automatically end up in the announcements system. This is a key component in my quest for the widespread sharing of information in the school.

Comments are closed.