1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Page Rotator?

Discussion in 'Programming' started by T-Soul, Jan 23, 2006.

  1. #1
    Hi, im looking for help with something im working on.

    Basicly i have a code that allows me to have any website within my sites (in frames)
    
    <frameset rows="140,*" frameborder="NO" border="0" framespacing="0">
      <frame src="top.php" name="topFrame" scrolling="NO" noresize >
      <frame src="http://www.domain.com" name="mainFrame">
    </frameset>
    Code (markup):
    i want to no if its possable to have rotating URLs where http://www.domain.com is? say every 10 seconds a new URL would appear in frame?
    im not sure if its php i need, if anyone can point me in the right direction id appreceite that.

    Thanks un advance

    Tony
     
    T-Soul, Jan 23, 2006 IP
  2. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #2

    I'm no php god, there are easier ways. But if it works who cares, right?

    
    <?
    srand((double)microtime()*1000000);
    function randString($l) {
    	if($l==0)
    		return "";
    	else
    		return randChar().randString($l-1);
    }
    
    function randChar() { 
    	$str = "0123456789";
    	return substr($str, rand(0, strlen($str)-1), 1);
    }
    
    $random_number = randstring(1);
    
    if ($random_number=="0") {$site="http://www.site0.com";}
    if ($random_number=="1") {$site="http://www.site1.com";}
    if ($random_number=="2") {$site="http://www.site2.com";}
    if ($random_number=="3") {$site="http://www.site3.com";}
    if ($random_number=="4") {$site="http://www.site4.com";}
    if ($random_number=="5") {$site="http://www.site5.com";}
    if ($random_number=="6") {$site="http://www.site6.com";}
    if ($random_number=="7") {$site="http://www.site7.com";}
    if ($random_number=="8") {$site="http://www.site8.com";}
    if ($random_number=="9") {$site="http://www.site9.com";}
    
    print <<<EOT
    
    <frameset rows="140,*" frameborder="NO" border="0" framespacing="0">
      <frame src="top.php" name="topFrame" scrolling="NO" noresize >
      <frame src="$site" name="mainFrame">
    </frameset>[/
    
    EOT;
    
    ?>
    
    PHP:
    If you want less than 10 sites then edit

    $str = "0123456789";

    Hope it helps.
     
    SERPalert, Jan 23, 2006 IP
  3. T-Soul

    T-Soul Peon

    Messages:
    85
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for your help ill give it a go :)

    Tony
     
    T-Soul, Jan 23, 2006 IP
  4. T-Soul

    T-Soul Peon

    Messages:
    85
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    SERPalert: it doesnt work unfortunatly, thanks anyway
     
    T-Soul, Jan 23, 2006 IP
  5. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'm happy to help you resolve it, what's the error?

    Edit: Worked fine for me.

    When I cut and paste it out of this forum it seem to put the whole thing on one line, which wont help.

    Try cutting and pasting from this quote:

     
    SERPalert, Jan 23, 2006 IP
  6. Smyrl

    Smyrl Tomato Republic Staff

    Messages:
    13,740
    Likes Received:
    1,702
    Best Answers:
    78
    Trophy Points:
    510
    #6
    Of concern to me is do you have premission to show someone elses content in an I-frame?

    Shannon
     
    Smyrl, Jan 23, 2006 IP
  7. T-Soul

    T-Soul Peon

    Messages:
    85
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    SERPalert : thanks its seems to work im going to play with it now, thnaks againf or your help :) much appreciated

    Smyrl : yes of course its going to be my sites withing the frame.
     
    T-Soul, Jan 23, 2006 IP
  8. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Such code does exist, they might be his own sites...?
     
    SERPalert, Jan 23, 2006 IP
  9. T-Soul

    T-Soul Peon

    Messages:
    85
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Yes they are my own sites lol , im not going to randomly rotate random sites thats would be madness lol

    SERPalert: is there a way to have the pages rotate every 10 seconds, for intsance, site1.com stays there for 10 seconds then changes to site2.com or any random site?

    Thanks again and sorry to bother you.

    Tony
     
    T-Soul, Jan 23, 2006 IP
  10. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #10
    It's possible using a mysql database.....but that would be more than 14 seconds of me throwing something together....what's it for?....Inspire me and I might take 30 minutes out to help!

    I got a busy night tonight, sorry.
     
    SERPalert, Jan 23, 2006 IP
  11. T-Soul

    T-Soul Peon

    Messages:
    85
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Thanks SERPalert , basicly its for my portal to rotate all the subcatorgary sites homepages, like a showcase of sites shall we say.

    And its cool i appreciate your time i dont expect you to help if your busy , ill be patciant :)


    Maybe javascript would do the trick?

    Thanks
     
    T-Soul, Jan 23, 2006 IP
  12. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #12
    First I'd try www.hotscripts.com

    They have a whole bunch of stuff. You might try searching for "random website" or something similiar.

    I've seen lots of what you want, just a case of finding it :)
     
    SERPalert, Jan 23, 2006 IP
  13. T-Soul

    T-Soul Peon

    Messages:
    85
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #13
    thanks SERPalert i think ive found a nice bit of javascript that can help me.

    a question regarding your script, if i wanted more than 10 pages what would i do to this line?
    $str = "0123456789";

    thanks again
     
    T-Soul, Jan 23, 2006 IP
  14. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #14
    This is where my dirty code aint gonna help too much.

    $str = "0123456789";

    No need to add more numbers into it...

    Change the value in the brackets

    $random_number = randstring(1);

    I you give it a two it will create a two digit number...but here's the problem.

    It could be 01, 25, 92, 77 etc.

    However you could add a,b,c etc to the sting thusly:

    $str = "0123456789abcdefg";

    To get more values.

    Then in the rest of the script you can do if($random_number=="c") {$site=="www.something.com";}

    Hope you understand, good luck
     
    SERPalert, Jan 23, 2006 IP
  15. T-Soul

    T-Soul Peon

    Messages:
    85
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #15
    thanks again SERPalert, im certanly learning alot tonight, ill give it a whirl, also ill show you results on completion :)

    Cheers
     
    T-Soul, Jan 23, 2006 IP
  16. T-Soul

    T-Soul Peon

    Messages:
    85
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #16
    post removed by me, i fixed it ;)
     
    T-Soul, Jan 25, 2006 IP