best very simple php banner rotator?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gleem
    Confirmed User
    • Jun 2001
    • 5593

    #1

    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.




    Contact me: \\// E: webmaster /at/ unprofessional.com
  • Lycanthrope
    Confirmed User
    • Jan 2004
    • 4517

    #2
    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.

    Comment

    • gleem
      Confirmed User
      • Jun 2001
      • 5593

      #3
      Originally posted by Lycanthrope
      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?




      Contact me: \\// E: webmaster /at/ unprofessional.com

      Comment

      • Lycanthrope
        Confirmed User
        • Jan 2004
        • 4517

        #4
        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

        Comment

        • gleem
          Confirmed User
          • Jun 2001
          • 5593

          #5
          Originally posted by Lycanthrope
          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




          Contact me: \\// E: webmaster /at/ unprofessional.com

          Comment

          • k0nr4d
            Confirmed User
            • Aug 2006
            • 9231

            #6
            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>";
            ?>
            Mechanical Bunny Media
            Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development

            Comment

            Working...