I'm looking for a simple script which will rotate my ads. I've tried a few I found searching the internet or these forums but none of been what I have been looking for. Some of them haven't liked javascript in javascript (the google ads was JS, as was the rotator) and some have only been for banners or text links. All I am after is a simple bit of code I can put in which will randomly change the adsense code (its all link units, I'm just varying the colour) on a page refresh. Doesn't have to be fancy or do any tricks. I just want it to rotate the ads. Can anbody make any recomendations? Thanks Dan
Many of the banner rotators have you just insert html/text. IF you find one like this you could use it as an adsense code rotator / or simple revenue sharing script
Phpadsnew rocks. I can help you to install it if you want to. If you dont read the documentation, you will keep wondering how to use it
just use Server-Side language to write out the javascriopt. create 5 strings in PHP/ASP/CF whatever... then put them strings into an array server-side. then randomize a number (from 0 to 4) and display that array's item - where the random number is the array index Do NOT attempt to do this with JS because it will most likely be against their TOS and will probably F up the Adsense script - Simple solution - just let your Serverside Script write the JS.
You've got exactly what I'm looking for, just a bit of code I can insert on to a page, but I'm no coder so I wouldn't know where to start looking for the information to chuck one together.
I tried using phpadsnew but I got an error about my register_long_arrays. It also seems to be much more complex than I actually need. I just need a bit of php code which will randomly rotate some ads on a page refresh.
Hi, Once again I am here. Is this what you are looking for. This is in asp because i am not familliar with php. i had to do a lot of search on the internet(I spent 2 nights doing this ) then i had to debug it as the first three codes did'nt work. The code is simple but i had to spend a lot of time doing this. It really amazed me how a simple task as this would eat up so much of my time. And the most amazing thing is that it is just a two line code I will explain everything to you and also help in installation.
I have chosen completely different layouts because i wanted them to make it distinguishable and the differences to be recognizable. However, you can choose any layout of your choice when you use them and any no. of different layouts. But i recommend to not to use more than 4-5 layouts per position as it will make ads to be repeated.
Make a new php file for every ad and insert the adcode in it. And name them 1.php 2.php ect. On the place you wanna insert the ad place this code: <?php // If you have 5 ads random = rand(1, 5); include "$random.php"; ?> PHP: This will pick a random number between 1 and 5 and includes that php file into that location.
somehow but i knew it won't work. it is true that i am not familiar with php but i am a kinda experienced programmer and by looking at the code i knew it wont work so i asked Gekkie for a demo. If you are intretsed in my code then rep me. i can perhaps make it work for you even if your host does'nt support asp infact i know what is the problem with the Gekkie's PHP code. the same thing happened in my similar asp code too. The code i have for asp is unique and is an inbuilt function of asp. i don't know if a similar solution exists for PHP. And yes i did it for money but now i feel if you were to want to spend money for it you would have had posted it in the business forum, so ...........
Ok try this. i don't know if it will work but just trying my coding common sense. Remove the " marks and place it the way i have in this code for random.php.It should be $random.".php". and not "$random.php" Good luck with your code. <?php // If you have 5 ads random = rand(1, 5); include $random.".php"; ?> PHP: But still i beleive an include directive will not be able to read this and it may give errors. Just try; i don't have a php account or else i would have tested it.
http://www.flash-here.com/downloads/randomad.html Thats what you are looking for. Just upload the 3 files, put your ads in the txt file, and place the code where you want your ads. It works great for me.
this works.... <?php // If you have 3 ads $random = rand(1, 3); // store the full path and filename $filename = "$_SERVER[DOCUMENT_ROOT]/toplevel/nextlevel/adsdirectory/$random.php"; // get the random adsense ad include ("$filename"); ?> NB : change this "/toplevel/nextlevel/adsdirectory/" to whatever absolute path your 1.php, 2.php....n.php are held in (eg from your top level directory to the directory where you ads are held). it works for me. if it does for you then a 'greeny' wouldnt go a miss. thanks