Skip to main content
Participating Frequently
January 22, 2008
Question

Need Help Displaying Query

  • January 22, 2008
  • 2 replies
  • 299 views
I am having problems with this, I need to re-write this into 3 different routes the CFIF can take. Currently this works because the query only returns 9 records, they are being displayed as 3 rows with 3 columns. I need to re-write and have it where if the record count is LT9 to only have the output be on 2 columns with 3 rows....and if the count is LT6 then i only want 1 row with 3 columns. I am having problems figuring out how to modify this code to accomplish this task. Any help would be greeeeeeeeeeeeat.

<cfif alsobought_counter LTE 9>
<cfif (prodCount+(detailsColCount-1)) MOD detailsColCount EQ 0><div class="clearfix"></cfif>
<div class="productThumbCont">
<cfset product_link = link("product", alsoBought_product_id, product_title)>
<div class="productThumbImg">
<a href="#product_link#" class="picksLink" title="#linktitle#"><img src="#cfimage[alsobought_counter].thumb.path#" alt="" border="0"
tooltip="#alsoBought_product_id#" />
<cfif len(trim(qryAlso_Bought.is_ondemand)) and qryrelated_products.is_ondemand EQ 1 AND qryAlso_Bought.is_disabled
NEQ 1 AND request.allowVOD eq 1><div class="on-demand-call-out"
style="cursor:pointer;margin-top:-22px;margin-top:-25/**/px;margin-left:21px;background:
url(../skins/graphics/btns/ondemand-overlay.gif) 0 0
no-repeat;width:79px;height:22px;filter:alpha(opacity=80);-moz-opacity:.80;opacity:.80;"></div></cfif></a>
</div>
<div class="productThumbTitle">
<a href="#product_link#" class="picksLink"
title="#linktitle#">#product_title#<cfif len(trim(extendedTitle))>
(#extendedTitle#)</cfif></a>
<!--- <cfif len(trim(qryAlso_Bought.hotmovies_id)) AND
qryAlso_Bought.is_disabled NEQ 1 AND request.allowVOD eq 1><div
style="padding-top:5px;"><img
src="../skins/graphics/btns/ondemand.gif" alt="Available On-Demand"
border="0" /></div></cfif> --->
</div>
</div>
<cfif prodCount MOD detailsColCount EQ 0></div></cfif>
<cfset prodCount = IncrementValue(prodCount)>
<cfset alsobought_counter = IncrementValue(alsobought_counter)>
</cfif>
</cfoutput>
<cfif (prodCount-1) MOD detailsColCount NEQ 0></div></cfif>
</div> Text
This topic has been closed for replies.

2 replies

Participating Frequently
January 23, 2008
I think that's my issue, I don't understand where the rows and columns are really coming from.
Inspiring
January 23, 2008
After you run your query, look at the record count. Run all the if/else logic you have to to determine the number of columns you want. Don't worry about the number of rows, that will take care of itself.

Once you have the number of columns figured out, output your data as simply as possible, no style tags, no links, just data. Use the modulus operator to decide when to start a new row.

Once you've accomplished that, start adding the rest of your stuff.