Off Topic: My Open Source Project

This has nothing to do with LDS issues, but since my co-bloggers haven’t had much to say this week, and there are plenty of you LDS bloggers out there who are interested in web development, I thought I’d post about my very first open source project. Most of you have probably seen and used the javascript commenting hacks I wrote for blogger-based blogs last year under the name Ebenezer Orthodoxy. Well, my latest project is more abstract and widely applicable, and has potential to revolutionize PHP based web sites, including blogging software like WordPress and b2evolution. And it is free.

The newest buzzword in web development is Ajax. If you haven’t heard about it you soon will. Ajax is a name recently coined to describe the combination of technologies that have been used to create the new generation of fancy websites like GMail and Google Maps. At the core of these fancy new web-based applications is the Javascript XMLHttpRequest object, which permits a web page to request additional information from the server without reloading the web page.

I have created a PHP class library to facilitate the easy development of web based applications that use Ajax to communicate with the server asynchronously and update web page content. I call my library xajax.

Basically, the xajax PHP class automatically generates JavaScript wrapper functions for the PHP functions you want to be able to call asynchronously from your web page. When called, these wrapper functions use JavaScript’s XMLHttpRequest object to asynchronously communicate with the xajax class on the server which calls the corresponding PHP functions. Upon completion, an xajax XML response is returned from the PHP functions, which the xajax class passes back to the web page. The XML response contains instructions and data that are then parsed by xajax’s JavaScript message pump and used to update the content of your web page.

Because Ajax uses only standard technologies like HTML DOM, CSS, and Javascript, xajax lets you use PHP to provide rich content and interfaces without having to install a plugin like Macromedia Flash. It works in Mozilla based browsers, like Firefox, as well as in Internet Explorer and Safari.

The potential for blogs is unexplored. One possible use would be a javascript function that would automatically query the server for new comments every 30 seconds and update the recent comments list without having to reload the page. How many times have you posted a lengthy comment only to find that while you were typing, someone else posted nearly the same thing. Using xajax, it might be possible to continue to display new comments on the page as they are posted, while comments are being composed. Commentators could see the new comments appear without having to reload.

There are usability issues to be considered, but the potential is exciting.

My xajax library homepage is at http://xajax.sourceforge.net.

I would love to see the Bloggernacle become a leader in blogging innovation. Feel free to explore possibilities here in the comments.

9 thoughts on “Off Topic: My Open Source Project

  1. Using xajax, it might be possible to continue to display new comments on the page as they are posted, while comments are being composed.

    This definitely sounds like a revolutionary tool. I’m really impressed with your knowledge of code, programming and the potentials.

  2. Just started using XMLHttpRequest and honestly don’t know why it took the web world so long. I also code mostly in PHP for work, and so I feel credible when saying xajax sounds like a GREAT innovation. Good for you.

  3. Best ajax app I’ve ever seen is Gmail… If anybody want’s invites I’ve got some.

    Some problems with ajax scripts: on a popular blog like Millenial Star or Times and Seasons, if lots of people are reading, you’re going to be hitting the server hard. These are the problems with popularity: If you’re going to do something big like load new comments you have to be smart. Something like: build a predicate that only returns 0 or 1 if there are new comments based on the current latest comment number, an integer, that you send across the wire. If you have lots of queries every 30 seconds that are much bigger than that, you’re going to take a major hit. So, you make a second request only if there are new comments for the comments. Well, that’s a thought anyway. Not sure how that would play out…

  4. AJaX has been around for years. The problem was that JavaScript got a bad rap a couple of years back and it inhibited anything like AJaX taking hold. GMail, Google Maps, flickr and the like have brought it to the forefront. I’ve been working on some small apps at work, like editing page content on the fly and suggesting search terms (like Google Suggest but querying an LDAP server).

    I know it was just an idea thrown out as an example, but another problem with refreshing comments, is that the comment text field the person is currently using will continue to be shifted down the page as the recent comments come rushing in.

  5. Kim (#8) the comments problem could be solved by changing the comment page (but then, I think most of the entire bloggernacle would really enjoy and could really, really use some comment additions sans ajax, like threading… then I wouldn’t have to say: “Kim (#8)” whenever I wanted to reply to you) so that you have to click a reply button to comment or something like that… But the comment box at the top of the page, and move the comments below it. Or, list new comments below the comment box. Or, simply provide a gmail style “New Comments Available” box and only fetch them upon the users click of an additional submit button that preserves their post but adds the new comments to the page… The possibilites are endless, as long as you’re willing to go the javascript route…

Comments are closed.