I want to create an ad rotator, that changes the ads that are displayed every time the page is viewed. How would I do this? Is it possible to do this in html? Thanks, Kyle
i've been looking around for it too as the previous poster said, it would not be efficient to do in HTML i have figured out that the best way to do it is in javascript, now im just working out a way on how to do it
well .. you should have an array with ad codes .. you can display the ad with document.write(ar[x]) where ar[0]=code1;ar[1]=code2;x=math.rand(0,1); this is how it would work in javascript
In php you need a code like this one : <?php // array with ads $ads = array('ad_code1', 'ad_code2', ' ...' , 'ad_code10'); // random display $rand = mt_rand(0, count($ads)-1); echo $ads[$rand]; ?> PHP:
Ok, but is there a website, or software, where you just enter the adsense and banner ads that you want to rotate and it will give you a code that you can put on your site? Thanks, Kyle
or in .net.... <asp:AdRotator ID="Ad1" runat="server" AdvertisementFile="adsfile.xml" /> Code (.Net):
If you find one, please let me know. I've been looking to do the same thing and having problems finding a means to do it since i'm not real familiar with php or javascript.
you can use php ads at http://www.phpadsnew.com , its an opensource program that does exactly what you are looking for and has very good documentation. Setting it up is piece of cake