Need to know how fast this string rotates.

Discussion in 'PHP' started by Jen-, Sep 6, 2006.

  1. #1
    Can anyone tell me where this shows how fast it rotates something? I can't tell by looking.
    I would like to adjust it to rotate more slowly but can't tell where this
    would be done. Thanks!

    $banner_no = (rand()%(count($s_con)-1));
    //simple echo the content
    echo $s_con[$banner_no];
     
    Jen-, Sep 6, 2006 IP
  2. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #2
    This code will get random number from 0 to count($s_con)-1 and echo the contents of array element with this index (banner code as I understand). More elements in array - less chances to see the same banner twice.
     
    wmtips, Sep 6, 2006 IP
  3. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    wmtips is right. If you want a particular ad to show more frequently, you would need to add it a few times to the $s_con array.

    If you wanted to make a particular ad show less frequently, well... you could just add all of the other ads a few more times, but I would suggest redoing the algorithm, basically.
     
    TwistMyArm, Sep 6, 2006 IP
  4. Jen-

    Jen- Peon

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Maybe I'm not making myself clear. I mean how fast does it rotate...
    seconds, miliseconds, do you see anything like that in it? Because its rotating very fast but this is the only code in the php code that I can see that has anything to do with speed. The other php code doesn't look like it contains anything having to do with how fast it moves. Please let me know, thanks!
     
    Jen-, Sep 7, 2006 IP
  5. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #5
    I don't know the contents of $s_con array, so can not see what is "rotating". Give us a sample.
     
    wmtips, Sep 7, 2006 IP
  6. petronel

    petronel Peon

    Messages:
    113
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    the banners are shown in a random order.. so, the script is not "rotating" like showing banner A for x seconds, then banner B for y seconds.. and so on..
    it just pick a random banner each time the page is loaded
    if each banner is in that array 1 time, then each banner has same probablility to show.
     
    petronel, Sep 7, 2006 IP
  7. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Would be good to have a link or something.

    Maybe it's a problem with the actual image: nothing to do with the PHP code that loads it?
     
    TwistMyArm, Sep 7, 2006 IP
  8. kjewat

    kjewat Active Member

    Messages:
    149
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #8
    Is the code contained in some kind of loop or something?

    As petronel said, there is no code there that make the banners rotate..
     
    kjewat, Sep 7, 2006 IP
  9. Jen-

    Jen- Peon

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Strange, ok well that helps me know where not to look, I'll try again. Thanks very much!
     
    Jen-, Sep 8, 2006 IP