Simple ad rotator script
by Sapphire (May 13, 2006)
ETA: a fix (scroll down)
If you want a really simple ad rotator, try this one from FlashHere.com. No ads, no control panel, no MySQL database. You just upload to your server a php file (the script) and a text file. Then you paste the ad code into that text file, one ad per line. Finally, you put a bit of code into your webpage, wherever you want the ads to appear.
It’s an Iframe, so it’s fast-loading. You can style and tweak the adspace by messing with the Iframe code. Change the width and height to match the banner size you’re using. I added some margin to create more whitespace around the ad.
You can include text ads with this, too - they’ll just fit into the banner space you’ve specified in your Iframe code. Or include your AdSense code or the code from any similar service.
You could also use this to include ever-changing ads within your entries, by tossing the code into each entry, or putting the code into a plugin that does the same thing.
ETA: If you have trouble getting this to work - in my case, it showed a tiny portion of my site header instead of any banner ads - it’s a path issue you can easily fix. Look at your Iframe code on the page where you want it displayed. Close to the end it says:
“src=”randomad.php”
Change that to:
src=”http://yoursite.com/randomad.php”
Assuming you put it in the top folder of your web directory. If not, just add the other folders into the path. I’m glad I figured this out - I had given up and was looking for other scripts, and there just aren’t any as small and simple and reliable out there.


