ballhogjoni Posted June 22, 2007 Share Posted June 22, 2007 I am trying to develop a simple script that will rotate little ads. Not looking to rotate images but little bits of html files. Does anybody have any idea how to start and then is there a function that pulls random code from html files? Thank in advance Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 22, 2007 Share Posted June 22, 2007 put all your html files as includes in a folder and label them in an array style and then explain how you want to rotate. You could do a mysql table that says how many times each ad has been viewed and auto loads the least viewed ad. or you could say select a random ad or you could say select random, but show least shown more often or show paid more more often Quote Link to comment Share on other sites More sharing options...
chigley Posted June 22, 2007 Share Posted June 22, 2007 Simplest form: <?php $ads = array("<a href=\"http://www.google.co.uk\">Free search engine!</a>", "<a href=\"http://www.phpfreaks.com\">PHP help!</a>"); $rand = array_rand($ads); $advert = $ads[$rand]; echo $advert; ?> Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted June 23, 2007 Author Share Posted June 23, 2007 Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.