I have about 25 or so images that I would like to serve up on my site's home page. I would like the image to change every 3 days or so. Does anyone have a hint as to how I might go about doing this in a simple fashion?
I don't want it to be random, but I do want it to cycle through the images and then start over again.
Some initial thoughts: I could just set up a custom index rather than a simple series (1,2,3...). I could then serve up the image that matches the current day of the month or matches a day range. But this gets tricky because I don't have exactly 31 images, and there are obviously shorter months. AND, I want to be able to enter more images without breaking the code.
I could do it randomly, and also store an "exclusion list", so every three days, my page gets a new random image whose index is not stored in this exclusion list. This seems like the most likely approach, but sounds like extra work.
Any ideas? tnks
Well, it's certainly possible. You can use opendir() and readdir() (or the dir object) to read the file names from a directory, choose three of them, and output their paths to the <img> tags.
You could incorporate another file that "remembers" the last image you chose, then when it picks the next 3, it'll start from that point. As long as you order the results the same each time (sort(), ksort(), etc), you should be fine.
If you want the script written for you, contact me offline.
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php