I attempted this post in the general discussion and got no responses so I
thought I would see what anyone over here thought.....

I am working with a gerry rigged version of an ad rotator and click tracker.
It allows the user to call the module with a zone attached to it so the ad
choices will be diff fro any given page based on the zone of the call.

For some reason if I call the module - like this for instance

<cfoutput><cfmodule template="../CFTags/CFTagBannerAds.cfm" zone="#zone#"
adtype="banner" ad_align="top" ad_class="bannerad" /></cfoutput>

I get two advertisements showing up. I have been looking at this for an
hour now and hove gotten nothing but glazed eyes. Can someone please help.

Thanks in advance- Chris

Here is the Tag...

<cfsilent>
<!---

Name: CFTagBanner_ads.cfm
Description:
Called from any page displaying an ad banner.
Displays and records hits and click thrus of banner ads
Tag synax:
====================================
<cfmodule template="CFTagtbl_ads.cfm" zone="home" adtype="code"> displays a
code type ad from the home zone
<cfmodule template="CFTagtbl_ads.cfm"> Displays the default 468x60 from any
zone
====================================
--->
<!--- param needed vars --->
<cfparam name="URL.AdType" default="banner" type="string">
<cfparam name="URL.Zone" default="all" type="string">
<cfparam name="attributes.AdType" default="#URL.AdType#" type="string">
<cfparam name="attributes.Zone" default="#URL.Zone#" type="string">
<cfparam name="attributes.ad_align" default="">
<cfparam name="attributes.ad_class" default="">

<cfset ad.action = #iif(IsDefined("URL.AdAction"), DE("click"),
DE("display"))#>
</cfsilent>
<cfswitch expression="#ad.action#">
<cfcase value="display">
<!--- if a zone was passed then check for those ads --->
<cfif attributes.zone NEQ "" AND attributes.zone NEQ "All" >
<cfloop index="listelement" list="#attributes.zone#" delimiters=",">
<!---get all the ads whose zone matches--->
<cfquery name="getAdIDs" datasource="#request.dsn#"
username="#request.dsnusrnm#" password="#request.dsnpwd#">
SELECT ad_id FROM tbl_ads
WHERE ((ad_zone LIKE '%#listelement#%') OR (ad_zone LIKE '%All%'))
AND ad_active = true
AND ((ad_Type = 'banner') OR (ad_Type = 'code'))
</cfquery>
</cfloop>
<!--- else just grab a list of any banner ads--->
<cfelse>
<cfquery name="getAdIDs" datasource="#request.dsn#"
username="#request.dsnusrnm#" password="#request.dsnpwd#">
SELECT ad_id FROM tbl_ads
WHERE ad_active = true
AND ((ad_Type = 'banner') OR (ad_Type = 'code'))
</cfquery>
</cfif>
<!---get the default banner if no others are available.------->
<cfif getAdIDs.recordcount EQ 0>
<cfquery name="getAdIDs" datasource="#request.dsn#"
username="#request.dsnusrnm#" password="#request.dsnpwd#">
SELECT ad_id FROM tbl_ads
WHERE ad_zone = 'default'
AND ((ad_Type = 'banner') OR (ad_Type = 'code'))
</cfquery>
</cfif>

<!----choose a random banner from known ids ------->
<cfset VARIABLES.RandomID = RandRange(1, getAdIDs.RecordCount)>
<cfset VARIABLES.thisAdID = ListGetAt((ValueList(getAdIDs.ad_id)),
VARIABLES.RandomID)>

<!----Get a banner ad with that ID --->
<cfquery name="getOneBanner" datasource="#request.dsn#"
username="#request.dsnusrnm#" password="#request.dsnpwd#">
SELECT ad_id, ad_websiteurl, ad_imgLoc, ad_hgt, ad_wdt, ad_alt,
ad_memberid
FROM tbl_ads
WHERE ad_id = #VARIABLES.thisAdID#
</cfquery>

<!---
================================================== =============================
Show the actual advertisement --->
<cfoutput>
<a
href="#request.localpath#CFTags/CFTagBannerAds.cfm?AdAction=Click&thisURL=#getOneB anner.ad_websiteurl#&ad_id=#getOneBanner.ad_id#"ta rget="_blank">
<img
src="#request.localpath#ads/#getOneBanner.ad_memberid#/#getOneBanner.ad_imgLoc#"
alt="#getOneBanner.ad_alt#"width="#getOneBanner.ad _wdt#"
height="#getOneBanner.ad_hgt#" border="0" align="#attributes.ad_align#"
class="#attributes.ad_class#" /></a>
</cfoutput>

<!----update times displayed------->
<!--- Find out if the ad already exists in the adclicks tabble.
If not - create the first record for it --->
<cfquery name="Checkads" datasource="#request.dsn#"
username="#request.dsnusrnm#" password="#request.dsnpwd#">
SELECT click_id FROM tbl_adclicks WHERE ad_id = #VARIABLES.thisAdID#
</cfquery>

<cfif Checkads.recordcount EQ 0>
<cfquery name="updateAdViews" datasource="#request.dsn#"
username="#request.dsnusrnm#" password="#request.dsnpwd#">
INSERT INTO tbl_adclicks
(ad_id, views) VALUES (#VARIABLES.thisAdID#, 1)
</cfquery>
<cfelse>
<cfquery name="updateAdViews" datasource="#request.dsn#"
username="#request.dsnusrnm#" password="#request.dsnpwd#">
UPDATE tbl_adclicks
SET views = views + 1
WHERE ad_id = #VARIABLES.thisAdID#
</cfquery>
</cfif>
</cfcase>

<cfcase value="click">
<!----update click thrus. ------->
<cfquery name="updateAdClicks" datasource="#request.dsn#"
username="#request.dsnusrnm#" password="#request.dsnpwd#">
UPDATE tbl_adclicks
SET clicks = clicks + 1
WHERE ad_id = #URL.ad_id#
</cfquery>
<!----and redirect------->
<cflocation url="#URL.thisURL#">
<cfabort>
</cfcase>
</cfswitch>


--
Chris Luksha
Echo Web Services
Making Your Website Resound
[url]www.echowebservices.com[/url]