Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3

Thread: banner rotator

  1. #1
    Member
    Join Date
    Nov 2002
    Posts
    61
    Member #
    275
    hi ineed a decent easy too use banner rotator that will fir into my coding allright

    PHP Code:
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
               <
    tr><td width="100%" align="center"><img border="0"
        
    src="images/adtop.gif" width="470" height="10"></td></tr>
    <
    td width="100%" align="center"><a
        href
    ="http://blackfoot.co.uk/index4.html" target="_blank">
        <
    img border="0" src="http://forum.pure-hardware.co.uk/banners/blackfoot.gif"
        
    width="467" height="100%"  alt="Blackfoot Recommended Uk Host"></a></td>
        <
    tr><td width="100%" align="center"><img border="0" src="images/cbot.gif" width="470" height="8"></td></tr>
                </
    tr>
              </
    table
    broke up lines to avoid breaking table layout here --filburt1

  2.  

  3. #2
    Senior Member assassingod's Avatar
    Join Date
    Nov 2002
    Posts
    112
    Member #
    307
    What do you mean? Here is a simple random image generator (with HREF)

    PHP Code:
    <?php
    srand
    microtime 1000000);
    $num rand(1,4)

    switch(
    $num)
    {
    case 
    $img="imgurl.ext"  $url="url.ext"; break;
    case 
    $img="imgurl.ext"  $url="url.ext"; break;
    case 
    $img="imgurl.ext"  $url="url.ext"; break;
    case 
    $img="imgurl.ext"  $url="url.ext"; break;
    }

    $banner "<a href=\"$url\">  ";
    $banner "<img src=\"$img\"> ";
    $banner "</a>";
    echo(
    $banner);
    ?>
    Replace the 4 with the number of banners you want, and make sure each case is the same as the number you specified

    If thats not what you meant, oh well
    assassingod - vB.org Moderator :ichatsmile:

  4. #3
    Junior Member Kriek's Avatar
    Join Date
    Mar 2003
    Location
    Florida
    Posts
    16
    Member #
    828
    Perhaps you are looking to rotate your entire code (tables, links, and images) together? Hmm don't ask me why, but some people prefer to do it this way. Place your items or code in a text file; for this example name it rand.txt and call the rotation using the following code.

    PHP Code:
    <?php
        
    // author kriek at jonkriek dot com 
        
    $tmp 0;
        
    $fp fopen ("rand.txt""r");
        while (
    $data fgetcsv ($fp2000"|")) {
            if (
    $data[0]) {
                
    $rand[$tmp] = trim($data[0]);
                
    $tmp++;
            }
        }
        
    fclose ($fp);
        
    $count $tmp-1;
        
    srand((double) microtime() * 1000000);
        
    $loopcount 0;
        while (!
    $rand[$pull] && $loopcount 100) {
            
    $pull rand(0$count);
            
    $loopcount++;
        }
        if (
    $rand[$pull]) {
            echo 
    "$rand[$pull]";
        } else {
            echo 
    "Sorry failed to display. Please refresh.";
        }
    ?>
    Everyone remain calm, I've done this before.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:29 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com