Re: ad banner rotator

From: Date: Tue, 05 Sep 2000 19:56:20 +0000
Subject: Re: ad banner rotator
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-15366@lists.php.net to get a copy of this message
Daniel Guerrier wrote: > > Is there a function in PHP that takes care of rotating > banner ads? One similar to the function available in ASP. I don't think there is such a function, but it should be trivial to implement. If you just want to show a random ad everytime someone loads a page, then you could use the following approach. 1) create a file with the following format: image: ad1.gif url: http://www.adsite1.com/ ---seperator---image: ad1.gif image: ad2.gif url: http://www.adsite2.com/ ---seperator---image: ad1.gif image: ad3.gif url: http://www.adsite3.com/ ---seperator--- ... and so on ... 2) when a user loads a page do the following: 2.1) count number of adds in file 2.2) generate random number between 1 and nr_adds_in_file 2.3) output (let's say ad2 was selected) <a href="http://www.adsite2.com/"><img src="ad2.gif"></a> 3) That's it, unless you also want to detect if people click the ad. If you have some specific needs, then drop me a email and I'll see if I can maybe write something for you. Best regards, Jesper Juhl juhl@eisenstein.dk

« previous php.general (#15366) next »