Hello, I want to show my ads rotationly between two ads . How to do it with php ? Ex : This is my two ads code <script language="javascript"> document.write('<iframe src="http://newt1.adultadworld.com/jsc/z5/ff2.html?n=607;c=2457;s=13527;w=468;h=60;p=13527" frameborder=0 marginheight=0 marginwidth=0 scrolling="no" allowTransparency="true" width=468 height=60></iframe>'); </script> PHP: And <script language="javascript"> document.write('<iframe src="http://newt1.adultadworld.com/jsc/z5/ff2.html?n=607;c=2457;s=13527;d=14;w=728;h=90;p=13527" frameborder=0 marginheight=0 marginwidth=0 scrolling="no" allowTransparency="true" width=728 height=90></iframe>'); </script> PHP: I only want one of them will be displayed on my page. PLease Help me !
switch (rand(1, 2)) { case 1: echo "Ad 1 code"; break; case 2: echo "Ad 2 code"; break; } Code (markup):
thats javascript check banner rotator under my blog http://www.crivionweb.com/phpblog/php-tutorial-random-banner-rotator/
You could do this with PHP if that's what you want: <?php //just some example $ads = 5; //amount of ads codes that can be shown $ad_show = mt_rand(1,$ads); //generate random ad ID switch($ad_show) { case '1': //show code of ad 1 break; case '2': //show code of ad 2 break; //... etc etc } ?> Code (markup): Just an example, if that's what you mean. Could also be done with a database containing all codes for example, with all unique IDs then let it get a random ID and show the code belonging to that ID. Skyfe.