GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   best very simple php banner rotator? (https://gfy.com/showthread.php?t=731704)

gleem 05-09-2007 10:20 AM

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.

Lycanthrope 05-09-2007 11:00 AM

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.

gleem 05-09-2007 11:07 AM

Quote:

Originally Posted by Lycanthrope (Post 12398308)
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.

ahh, sweet, it's that simple huh?

How often would it show each banner? An equal amount of times? Is there a simple way to assign % show weights to each?

Lycanthrope 05-09-2007 11:15 AM

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

gleem 05-09-2007 11:42 AM

Quote:

Originally Posted by Lycanthrope (Post 12398407)
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


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

k0nr4d 05-09-2007 12:40 PM

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