Link to home
Start Free TrialLog in
Avatar of sglee
sglee

asked on

Displaying Items in rows and columns

User generated imageHi,
 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
Avatar of erikTsomik
erikTsomik
Flag of United States of America image

can you just set a counter and count if it the counter is 3 then start new tr and reset and counter
Avatar of gdemaria
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

Avatar of sglee
sglee

ASKER

@gdemaria
Let me try playing with the CFIF.
Avatar of sglee

ASKER

User generated image@gdemaria
Having run the CFIF, I get the two items on first and last row.
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sglee

ASKER

User generated imageYes. 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>