I want to display ads that are assigned to the same industry segment(s) as
the content being viewed.

Is there an easier way to find matching content for a particular category
than this?
 
<cfset objCategories =
CreateObject("component","#application.packagepath#.farcry.category")>

<!--- locate the Industry branch --->
<cfset qList = objCategories.getCategoryByName(name="industry")>
<cfset IndustryCat=qList.objectid>

<!--- list the Industry children --->
<cfset qList =
objCategories.getCategoryBranchAsList(lCategoryIDs=IndustryCat)>
<cfset industryChildren=qList>

<!--- get ALL categories assigned to current content --->               
<cfset
lContentCats=objCategories.getCategories(objectid=request.stobj.objectid,bRe
turnCategoryIDs=1)>             
                
<!--- remove any content categories that are not in the Industry branch --->
<cfloop from="#listlen(lContentcats)#" to="1" step="-1" index="x">
        <cfif not listfind(industryChildren,listgetat(lContentCats,x))>
                <cfset lContentCats=listdeleteat(lContentCats,x)>
        </cfif>
</cfloop>

<!--- find all advertisements matching the content Industry categories --->
<cfset
qList=objCategories.getData(LCATEGORYIDS=lContentCats,typename="Advertisemen
t")>
        
<cfset lIndustryAds=valuelist(qList.objectid)>

Thanks,

Derek


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"farcry-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/farcry-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to