i've done this by using time. it's kind of 2 fold.
Weight 6
ad1,ad2,ad3,ad4
weight 3
ad5, ad6, ad7, ad8
-I'd assign the "weight" of each banner before hand.
-Grab the last digit in the seconds of the current time.
-Display an ad from the weight group that corresponds w/ the time integ
er
i.e.
if the last digit in the time was 6 it would display an ad w/ a weight
of 6
or higher and if it was 3 it'd display ads from the 3 weight group.
if i wanted an ad to have a chance of being displayed 70% of the time i
'd
set it to weight 3.
make sense? i would actually like to see a cleaner way of doing but th
at
works.
Savan
Elizabeth Walter <[EMAIL PROTECTED]> on 03/05/2002 12:14:29 PM
Please respond to [EMAIL PROTECTED]
To: CF-Talk <[EMAIL PROTECTED]>
cc:
Subject: Rotating banners
Hello-
I am developing a banner rotating tool and need some ideas on how to be
st
handle a requirement. I have gotten the tool to a point where it dis
plays
banners randomly- no problem. Now what I need to do is give certain
banners
more "weight" than others: some banners need to be displayed more
frequently than the rest. The code that I have below gives equal wei
ght to
each banner; I need to find a way to give some banners more prevalence
on
our pages.
<cfset activeBanners=arrayNew(1)>
<cfoutput query="qryActive">
<cfset activeBanners[#qryActive.currentRow#] = "#id#">
</cfoutput>
<cfset rows = arrayLen(activeBanners)>
<cfset randomId = randRange(1,#arrayLen(activeBanners)#)>
<cfquery datasource="#dsn#" name="qryBanners">
SELECT
i.*,
a.advert_name
FROM
images i, advertiser a
WHERE
i.id = #activeBanners[randomId]# and
i.advert_id = a.advert_id
</cfquery>
Any ideas?
Thanks in advance,
Elizabeth
______________________________________________________________________
Why Share?
Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists