• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 61
  • Last Modified:

Displaying Items in rows and columns

Item ListingHi,
 As you can see in the screenshot, there are 4 items under "Featured Items". Actually there are 7 items in the ACCESS table, the rest has been cut off unfortunately. I like to be able to display three items per row repeatedly until it runs out of items to display.
 My current CF Code is attached in CF-Code.txt
 Can you help?
CF-Code.txt
0
sglee
Asked:
sglee
  • 3
  • 2
1 Solution
 
erikTsomikSystem Architect, CF programmer Commented:
can you just set a counter and count if it the counter is 3 then start new tr and reset and counter
0
 
gdemariaCommented:
Add a <CFIF statement to place the new row <TR> after every 3 columns... the CFIF may need a little playing with but this is the idea.

<TABLE width=880 border="0" cellpadding="1" cellspacing="1" align="center" >
	<tr>
	<td colspan=3 align="center"><BR><font size=4 color=ffffff>Featured Items
	</td>
	</tr>
	<tr>
	<td colspan="3"><br />
	</td>
	</tr>
	<TR>
       <cfoutput query="GetFeaturedItems">
	      <cfif getFeaturedItems.currentRow mod 3 eq 0><cfif getReaturedItems.currentRow gt 1></tr></cfif><tr></cfif>
	      <td align="center" >
				   <table border="0" Style="border:2px outset black;">
			         <tr>
				     	<TD align="center" bgcolor="DDDDDD">
				    		<table width="100%" border="0" align="center">
							   <tr>
							   <td bgcolor="005BA4" colspan="2" align="center" height="60px" width="220px">
			         	 	   <font color="ffffff"> <B>#Title#</B></font>	   	
							   </td>
							   </tr>
							   <tr>
							   <td colspan="2" align="center" bgcolor="FFFFFF"><img border="0" width = "220" height="120" src="http://www.domainname.com/ImageUpload/#pic1#"><BR>
							   </td>
							   </tr>
							   <tr>
							   <td>
			 				   <b>Condition:&nbsp;&nbsp;
					   		   </td>
							   <td><font color="990000">#Condition#</font></b>
							   </td>
							   </tr>
							   <tr>
							   <td><b>Item No:</b>
							   </td>
							   <td>#numberformat(Price, "$(,.00)")#
							   </td>
							   </tr>
							   <tr>
							   <td colspan="2"><b>Description:
							   </td>
							   </tr>
							   <tr>
							   <td colspan="2"> <TEXTAREA NAME=Description ROWS=5 COLS=33 WRAP="VIRTUAL"><cfoutput>#GetFeaturedItems.Description#</cfoutput></TEXTAREA>
							   </td>
							   </tr>		
				            </table> 
			             </TD>
			          </tr>
				   </table>
	       </td>
	   </cfoutput>
	</tr>
	<TR><TD >&nbsp;&nbsp;&nbsp;</TD></TR>
	<tr>
		<!--<TD>&nbsp;&nbsp;&nbsp;</TD>-->
	    <td align="center"></td>
	</tr>
	<tr>
		<TD colspan=3>&nbsp;&nbsp;&nbsp;</TD>
	</tr>
	<!--<tr>
	<td colspan="3"><br />
	</td>
	</tr>-->
</table>

Open in new window

0
 
sgleeAuthor Commented:
@gdemaria
Let me try playing with the CFIF.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
sgleeAuthor Commented:
List Items@gdemaria
Having run the CFIF, I get the two items on first and last row.
0
 
gdemariaCommented:
How did playing with the CFIF go?  Any variations work?

Try putting the CFIF after the colums instead of before...

       <cfoutput query="GetFeaturedItems">
          <TR>
	      <td align="center" >
				   <table border="0" Style="border:2px outset black;">
			         <tr>
				     	<TD align="center" bgcolor="DDDDDD">
				    		<table width="100%" border="0" align="center">
							   <tr>
							   <td bgcolor="005BA4" colspan="2" align="center" height="60px" width="220px">
			         	 	   <font color="ffffff"> <B>#Title#</B></font>	   	
							   </td>
							   </tr>
							   <tr>
							   <td colspan="2" align="center" bgcolor="FFFFFF"><img border="0" width = "220" height="120" src="http://www.domainname.com/ImageUpload/#pic1#"><BR>
							   </td>
							   </tr>
							   <tr>
							   <td>
			 				   <b>Condition:&nbsp;&nbsp;
					   		   </td>
							   <td><font color="990000">#Condition#</font></b>
							   </td>
							   </tr>
							   <tr>
							   <td><b>Item No:</b>
							   </td>
							   <td>#numberformat(Price, "$(,.00)")#
							   </td>
							   </tr>
							   <tr>
							   <td colspan="2"><b>Description:
							   </td>
							   </tr>
							   <tr>
							   <td colspan="2"> <TEXTAREA NAME=Description ROWS=5 COLS=33 WRAP="VIRTUAL"><cfoutput>#GetFeaturedItems.Description#</cfoutput></TEXTAREA>
							   </td>
							   </tr>		
				            </table> 
			             </TD>
			          </tr>
				   </table>
	       </td>
	       <cfif getFeaturedItems.currentRow mod 3 eq 0></tr><tr></cfif>
	   </cfoutput>

Open in new window

0
 
sgleeAuthor Commented:
List ItemsYes. Moving CFIF to where you suggested worked. Thank you.

                           </td>
                           </tr>            
                  </table>
             </TD>
          </tr>
         </table>
         </td>
<cfif GetFeaturedItems.currentRow mod 3 eq 0>
  <cfif GetFeaturedItems.currentRow gt 1>
     </tr>
  </cfif>
     <tr>
  </cfif>
         </cfoutput>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now