For the backstreet project, I wrote a WP plugin that allows the user to control what shows up on the front page. One of those items was the main graphic, the big pic that sort of sets the tone for the whole front page. The reasoning behind it was so that they could use that space to promote big acts. Of course, they have not used it even once!
Anyway, I have recycled that plugin now for CCIC, and tonight, I decided to update it a little. The idea is that the users can upload as many pictures as they like, as long as they are the right size, and the front page will rotate through the pictures randomly each tome the page reloads.
Since I did backstreet, I have been using Gmail, and I really like how it is able to grab content in the background without me doing anything. So I got to thinking… what if you didn’t have to reload to see a new photo on the front page. How can we use AJAX to reload the images in the bacground, say on a timer.
Well, I have been following the XMLHttpRequest movement very closely, but I had not actually written any code. I decided this was the place to start. And you know what, it was rather anti-climactic. 5 minutes. It literally took 5 minutes to turn the front page into an automatic Javascript based slideshow that works like a charm. Now granted, I already had the infrastructure in place. So the images are already uploaded, there is already a function that returns a random image name. All I had to do was hook that function to a GET level parameter and copy some code from this excellent tutorial. (It is rare when a 1 page tutorial leads you to a point where you can do something useful, but here I am)
To be fair, it really isn’t AJAX, since I am not returning any XML, just a plain string. However, I find this extremely useful, and I think I am going to be using it in other places as well.
So go ahead and check it out http://cameraitacina.net.cn