Last week I went hunting for a little script that would rotate an image and a caption with every screen refresh. Should be a simple task, no?

I found many JavaScript ones, all different. I’m not a JavaScript expert and I like implementing code that I can get my head around – not many of the ones I found fit that bill. Plus, knowing that some visitors may have JavaScript turned off I thought better of it.

I looked for PHP scripts – I didn’t find as many, but I think I really lucked out when I discovered this tiny little PHP rotation script from Sue Crocker.

I love this. You just put it where you want to show the images and bang, it runs. No problems, no confusion. You put the images and accompanying captions into a text file separated by NEXT statements like this one. Within this text file, you can assign a CSS class to the captions so that they’ll show up in an absolutely positioned space and not directly under the image, as you can see in this page in progress. It’s the Featured Flower at the bottom that’s running the script – refresh the page to see it in action.

And it works beautifully. This is one of the most elegant and simple solutions I’ve found in a while.

Share It:

« »