The logic to do it works something like this: <!--- The number of columns required ---> <cfset cols = 4> <!--- The number of loop iterations to run through ---> <cfset records = 50> <!--- The number of empty cells to put in the final row ---> <cfset padding = records mod cols>
<!--- Open the table tag and first row ---> <table> <tr> <!--- Loop over the recordset, array or whatever ---> <cfloop from="1" to="#records#" index="i"> <!--- Output the image tag inside the table cell ---> <td>#i#</td> <!--- Check if i is exactly divisible by the number of columns. If so, close the row and start a new one ---> <cfif i mod cols EQ 0> </tr> <tr> </cfif> </cfloop> <!--- Create the padding cells ---> <cfloop from="1" to="#padding#" index="i"> <td> </td> </cfloop> <!--- Close out the table ---> </tr> </table> HTH Spike >-----Original Message----- >From: >[EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] >o.uk] On Behalf Of Ian Westbrook (FDM) >Sent: Monday, April 05, 2004 12:08 PM >To: CFUG List >Subject: [ cf-dev ] displaying images 4 across in a table... > >Hi >This is probably real simple, but it's something I've never >done before... > >If I wanted to display a record set 8 records at a time, but >in a table 4 across by 2 down (ie 4 cols, 2 rows), how would I >do that? I've looked at cftable, but that jusr seems to do the >same as looping a table row in a query output. > >I've got a lot of images, and I want to dislay them as >thumbnails (or, rather, setting the size in the output html) 8 >at a time, in a 4x2 matrix. > >Can someone give me some clues? > >ta > >Ian W > > > > -- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ CFDeveloper Sponsors and contributors:- *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com* *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com* *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com* To unsubscribe, e-mail: [EMAIL PROTECTED]
