How to rotate banners/headers on my PHP site?

Discussion in 'Programming' started by easydolla, Oct 26, 2008.

  1. #1
    What it dew,

    I have a script which is written in PHP. I have three different headers I would like too use, two in PNG format and one in SWF or flash.

    How can I get these headers to rotate?

    I am sure there is a script that can do this but can anybody point me in the right direction?

    Thanks!!!!!!!!!!!!!!!!!!!!!!
     
    easydolla, Oct 26, 2008 IP
  2. rhoula

    rhoula Well-Known Member

    Messages:
    875
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    145
    #2
    I had the same problem before what i did is create a page inside a page and put each banner in a different page then call it from the main page.
    Lets say that you want to display three banners banner1, banner2, and banner3. I would create three pages pge_banner1.php, pge_banner2.php, and page_banner3.php then inside you main page lets say index.php you will put a javascript script that will rotate the banners.
    If you want me to make a script for you I can please PM with reference to this thread and I will make you one.
    Thank you
     
    rhoula, Oct 26, 2008 IP
  3. serialCoder

    serialCoder Guest

    Best Answers:
    0
    #3
    just put your banner filenames in an array, and create a function that will randomly select the file.
    best done with php :)
     
    serialCoder, Oct 27, 2008 IP
  4. Estevan

    Estevan Peon

    Messages:
    120
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    0
    #4
    hello here is a simple example

    <?php
    $_ads[0]='<img src="http://www.google.com/intl/en_ALL/images/logo.gif">';
    $_ads[1]='<img src="http://forums.digitalpoint.com/images/misc/dps_logo.gif">';
    $_ads[2]='<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/G2F0wbwSOfY&hl=pt-br&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/G2F0wbwSOfY&hl=pt-br&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>';
    $n=rand(0,2);
    echo $_ads[$n];
    ?>
    PHP:
    Best
     
    Estevan, Oct 27, 2008 IP
  5. easydolla

    easydolla Peon

    Messages:
    403
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Lol thanks all but dont get it. I use TPL smarty engine. I have a TPL file called header.tpl but dont know how I could implement that code?
     
    easydolla, Oct 27, 2008 IP