Focus

This is the blog for my web design, development and marketing company, Red Kite Creative. Mostly what I'll be writing about is work-related but anything is fair game. Read more about me here...


View Debbie Campbell's profile on LinkedIn

What I'm Reading



View my bookstore













Easy PHP rotating image/text script

June 6th, 2007 by debbie campbell

It came to my attention over the weekend that the page referred to in this previous post is no longer available. So I’ll just post the script here.

< ?
srand((double)microtime()*1000000);
$arry_txt = preg_split("/--NEXT--/", join('',
file("featured_flower.txt")));
echo $arry_txt[rand(0, sizeof($arry_txt) -1)];
?>

Put this wherever you want the rotation to play, and link to a text file with your quotes, links to images on your server, etc. (mine is linking to a quote file ‘featured_flower.txt’ that also includes images). You can see a bit of the text file here.

I hope this makes sense. It’s a great little script and you can style it by putting it in a CSS div.

Posted in Timesavers, Web Design |

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment a bit. Please stay on topic. If you submit spam or irrelevant comments, it will be deleted and your IP will be banned.