![]() |
best very simple php banner rotator?
I need a very simple banner rotator to rotate some Iframe banners.. something that has almost load on the server, prefer something php non database run, flat file would be great, no stats needed..
anyone know of any? phpads is what I use now, but it's such a fucking resource hog I can't use it anymore. |
ad.php:
<?php $ads = file('ads.txt'); echo $ads[array_rand($ads)]; ?> ads.txt would contain your iframe / banner html. One entry per line, no blank lines. ie: <iframe src="http://www.domain.com/iframe_1.html"...></iframe> <iframe src="http://www.domain.com/iframe_2.html"...></iframe> etc. Then just include it <?php include("ad.php"); ?> where you want it. |
Quote:
How often would it show each banner? An equal amount of times? Is there a simple way to assign % show weights to each? |
That would just be completely random, no weighting. I'm not much of a programmer. Ok, I suck... but if you place an ad twice in your list, it would theoretically be twice as likely to be displayed :P
|
Quote:
Actually turns out the way the idiots that created my CMS did it, it won't parse a php include... guess I'm gonna have to try javascript instead.. I'll try your deal on my Wordpress site, shoudl work |
try this
<? $array = array("http://www.domain.com/iframe_1.html","http://www.domain.com/iframe_2.html"); shuffle($array); echo "<iframe src='$array[0]'></iframe>"; ?> |
All times are GMT -7. The time now is 07:55 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123