Hi Can anyone point me to a nice tutorial on rotating banner ads on my site? Perhaps using PHP includes? Any other "easy" methods of doing it? Cheers
The Simplest form of Ad Rotatation using PHP: Ads will be stored in a text file and picked randomly by PHP script. The Text file 'banner_ads.txt' will look like:- -------------------------------- <a href="target path"> <img src="target image"></a> * <a href="target path"> <img src="target image"></a> -------------------------------- where * is used for individualizing banners. The PHP code will be like:- -------------------------------- <?php $content = join ('', file ('banner_ads.txt')); $s_con = split("*",$content); $banner_no = rand(0,(count($s_con)-1)); echo $s_con[$banner_no]; ?> -------------------------------- Of course you can use the same procedure for any content to display randomly other than banner ads like 'random quotes' etc.
Thanks a lot guys. It seems to be even simpler than I thought. I'm learning more and more about PHP these days. Using things like includes make designing and updating a site so much easier.